Skip to content

Commit

Permalink
Merge branch 'main' into issue-#12
Browse files Browse the repository at this point in the history
  • Loading branch information
mastafit committed Jan 4, 2024
2 parents 751da54 + eaf73f7 commit 402ecd5
Show file tree
Hide file tree
Showing 7 changed files with 684 additions and 18 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Validate
on:
push:
branches:
- "**" # all branches
- "!main"
pull_request:
branches:
- main

jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
- name: NPM Install
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GWM_GH_TOKEN}}
- name: Build
run: npm run build
- name: Check types...
run: npm run typecheck

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
- name: NPM Install
run: npm ci --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GWM_GH_TOKEN}}
- name: Format...
run: npm run format

- name: Commit and push changes (if any)
uses: stefanzweifel/git-auto-commit-action@v4.2.0
id: auto_commit_action
with:
commit_user_name: seambot
commit_user_email: devops@getseam.com
commit_author: Seam Bot <devops@getseam.com>
commit_message: ci - format code

- name: Success
if: steps.auto_commit_action.outputs.changes_detected == 'false'
run: echo "Format check... PASS!"

- name: Fail
if: steps.auto_commit_action.outputs.changes_detected == 'true'
run: echo "Fixed formatting, and pushed changes" && exit 1
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"semi": false,
"singleQuote": false,
"trailingComma": "es5"
}
}
29 changes: 27 additions & 2 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import logResponse from "./lib/util/log-response"
import { getApiDefinitions } from "./lib/get-api-definitions"
import commandLineUsage from "command-line-usage"
import { ContextHelpers } from "./lib/types"
import { version } from './package.json';
import { version } from "./package.json"
import open from "open"

const sections = [
{
Expand Down Expand Up @@ -69,7 +70,7 @@ async function cli(args: ParsedArgs) {
console.log(usage)
return
}

if (
!config.get(`${getServer()}.pat`) &&
args._[0] !== "login" &&
Expand Down Expand Up @@ -168,6 +169,30 @@ async function cli(args: ParsedArgs) {

logResponse(response)

if (response.data.connect_webview) {
if (
response.data &&
response.data.connect_webview &&
response.data.connect_webview.url
) {
const url = response.data.connect_webview.url

if (process.env.INSIDE_WEB_BROWSER !== "1") {
const { action } = await prompts({
type: "confirm",
name: "action",
message: "Would you like to open the webview in your browser?",
})

if (action) {
await open(url)
}
} else {
//TODO: Figure out how to open the webview in the browser
}
}
}

if ("action_attempt" in response.data) {
const { poll_for_action_attempt } = await prompts({
name: "poll_for_action_attempt",
Expand Down
144 changes: 137 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "seam-cli",
"module": "index.ts",
"type": "module",
"version": "0.0.26",
"version": "0.0.27",
"repository": "git@github.com:seamapi/seam-cli.git",
"scripts": {
"cli": "tsx ./cli.ts",
Expand Down Expand Up @@ -54,7 +54,8 @@
},
"dependencies": {
"@seamapi/http": "^0.12.0",
"@seamapi/types": "^1.70.0",
"@seamapi/types": "^1.75.0",
"open": "^10.0.2",
"swagger-parser": "^10.0.3"
}
}
Loading

0 comments on commit 402ecd5

Please sign in to comment.