From c7450bff2613dea9f583b3fe53f1a253c7302968 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 14:52:25 -0700 Subject: [PATCH 01/14] Remove TS warning --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec906521..fbf1c203 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "tsx": "^4.6.2", "type-fest": "^4.3.1", "typedoc": "^0.25.2", - "typescript": "^5.1.0" + "typescript": "~5.3.0" }, "engines": { "node": ">=18.12.0", @@ -7798,9 +7798,9 @@ } }, "node_modules/typescript": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", - "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 15d65cad..a27775c0 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,6 @@ "tsx": "^4.6.2", "type-fest": "^4.3.1", "typedoc": "^0.25.2", - "typescript": "^5.1.0" + "typescript": "~5.3.0" } } From bccaf0a0b852cb366741613eeffafd4495f961b4 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 14:53:43 -0700 Subject: [PATCH 02/14] Throw error if missing new generated endpoints --- generate-routes.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate-routes.ts b/generate-routes.ts index 6d4c091f..5c62872d 100644 --- a/generate-routes.ts +++ b/generate-routes.ts @@ -127,11 +127,10 @@ const createRoutes = (): Route[] => { ) if (unmatchedEndpointPaths.length > 0) { - // eslint-disable-next-line no-console - console.warn( - `The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n${unmatchedEndpointPaths.join( + throw new Error( + `The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n\n${unmatchedEndpointPaths.join( '\n', - )}`, + )}\n`, ) } From 854504a60a5a7f5d5d050c6a6deaf1e597903e5a Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 14:54:49 -0700 Subject: [PATCH 03/14] Add dependabot and automerge support --- .github/dependabot.yml | 24 +++++++++++ .github/workflows/automerge.yml | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/automerge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..dab63983 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,24 @@ +--- +version: 2 +updates: + - package-ecosystem: npm + directory: '/' + schedule: + interval: daily + commit-message: + prefix: feat + include: scope + allow: + - dependency-type: production + ignore: + - dependency-name: '*' + update-types: + - 'version-update:semver-major' + groups: + seam: + dependency-type: development + patterns: + - "@seamapi/types" + update-types: + - patch + - minor diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000..7ab7e1e3 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,70 @@ +--- +name: Automerge + +on: + pull_request: + branches: + - main + +jobs: + changes: + name: Get changes for #${{ number }} + runs-on: ubuntu-latest + timeout-minutes: 30 + if: github.actor == 'dependabot[bot]' + permissions: + checks: read + outputs: + has_changes: ${{ steps.changed.outputs.any_changed == 'true' && steps.checks.outputs.conclusion == 'success'}} + steps: + - name: Wait for checks + uses: fountainhead/action-wait-for-check@v1.2.0 + id: checks + with: + checkName: generate + ref: ${{ github.event.pull_request.head.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Get changed generated files + id: changed + uses: tj-actions/changed-files@v44 + with: + dir_names: true + dir_names_include_files: | + src/lib/seam/connect/routes/** + merge: + name: Merge #${{ number }} + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: changes + if: needs.changes.outputs.has_changes == 'true' + steps: + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files_separator: ' ' + dir_names: true + dir_names_include_files: | + src/lib/seam/connect/routes/** + - name: Approve pull request + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Merge pull request + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + close: + name: Close #${{ number }} + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: changes + if: needs.changes.outputs.has_changes == 'false' + steps: + - name: Close pull request + run: gh pr close "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} From 3c9f45f7ac197848ceace496953c7a269680a988 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 14:56:03 -0700 Subject: [PATCH 04/14] Test automerge --- .github/workflows/automerge.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 7ab7e1e3..c825eecb 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -11,7 +11,7 @@ jobs: name: Get changes for #${{ number }} runs-on: ubuntu-latest timeout-minutes: 30 - if: github.actor == 'dependabot[bot]' + # if: github.actor == 'dependabot[bot]' permissions: checks: read outputs: @@ -51,11 +51,11 @@ jobs: env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Merge pull request - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} + # - name: Merge pull request + # run: gh pr merge --auto --merge "$PR_URL" + # env: + # PR_URL: ${{ github.event.pull_request.html_url }} + # GH_TOKEN: ${{ secrets.GH_TOKEN }} close: name: Close #${{ number }} runs-on: ubuntu-latest @@ -64,7 +64,8 @@ jobs: if: needs.changes.outputs.has_changes == 'false' steps: - name: Close pull request - run: gh pr close "$PR_URL" + # run: gh pr close "$PR_URL" + run: true env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GH_TOKEN }} From 9285f4b49f1aebbce80e16ff054beb6c277839b7 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Tue, 2 Apr 2024 21:56:50 +0000 Subject: [PATCH 05/14] ci: Format code --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dab63983..bb1e96bf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,7 +18,7 @@ updates: seam: dependency-type: development patterns: - - "@seamapi/types" + - '@seamapi/types' update-types: - patch - minor From d362b0481a560848b2b89215682fdc012f3c3ca6 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:00:19 -0700 Subject: [PATCH 06/14] Fix PR number in workflow --- .github/workflows/automerge.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index c825eecb..d8c1f1b5 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -8,7 +8,7 @@ on: jobs: changes: - name: Get changes for #${{ number }} + name: Get changes for #${{ github.event.number }} runs-on: ubuntu-latest timeout-minutes: 30 # if: github.actor == 'dependabot[bot]' @@ -32,7 +32,7 @@ jobs: dir_names_include_files: | src/lib/seam/connect/routes/** merge: - name: Merge #${{ number }} + name: Merge #${{ github.event.number }} runs-on: ubuntu-latest timeout-minutes: 30 needs: changes @@ -57,7 +57,7 @@ jobs: # PR_URL: ${{ github.event.pull_request.html_url }} # GH_TOKEN: ${{ secrets.GH_TOKEN }} close: - name: Close #${{ number }} + name: Close #${{ github.event.number }} runs-on: ubuntu-latest timeout-minutes: 30 needs: changes From 7f3c0e1b9632e5d38f9353cdb8339c585a6dfecc Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:00:31 -0700 Subject: [PATCH 07/14] Update checkName --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index d8c1f1b5..bc29f959 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -21,7 +21,7 @@ jobs: uses: fountainhead/action-wait-for-check@v1.2.0 id: checks with: - checkName: generate + checkName: Generate ref: ${{ github.event.pull_request.head.sha }} token: ${{ secrets.GITHUB_TOKEN }} - name: Get changed generated files From 9f15d51d9af381a2ca9c0ef49e815508687a6fd8 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:04:04 -0700 Subject: [PATCH 08/14] Update checkName --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index bc29f959..c9d879cd 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -21,7 +21,7 @@ jobs: uses: fountainhead/action-wait-for-check@v1.2.0 id: checks with: - checkName: Generate + checkName: Generate code ref: ${{ github.event.pull_request.head.sha }} token: ${{ secrets.GITHUB_TOKEN }} - name: Get changed generated files From 07fdf2bac3959e3375dec0cd6ca6679b1fba5a4c Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:05:39 -0700 Subject: [PATCH 09/14] Remove number from job name --- .github/workflows/automerge.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index c9d879cd..7931be75 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -8,7 +8,7 @@ on: jobs: changes: - name: Get changes for #${{ github.event.number }} + name: Get changes runs-on: ubuntu-latest timeout-minutes: 30 # if: github.actor == 'dependabot[bot]' @@ -32,7 +32,7 @@ jobs: dir_names_include_files: | src/lib/seam/connect/routes/** merge: - name: Merge #${{ github.event.number }} + name: Merge runs-on: ubuntu-latest timeout-minutes: 30 needs: changes @@ -57,7 +57,7 @@ jobs: # PR_URL: ${{ github.event.pull_request.html_url }} # GH_TOKEN: ${{ secrets.GH_TOKEN }} close: - name: Close #${{ github.event.number }} + name: Close runs-on: ubuntu-latest timeout-minutes: 30 needs: changes From ce9ddf63b86e4ab4cba2ac12d46f8a2eda511532 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:05:50 -0700 Subject: [PATCH 10/14] Fix run cmd --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 7931be75..4cbc0baf 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -65,7 +65,7 @@ jobs: steps: - name: Close pull request # run: gh pr close "$PR_URL" - run: true + run: 'true' env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GH_TOKEN }} From 200c1cf701d8e46452fa738a5ee8f50e674b6752 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:12:52 -0700 Subject: [PATCH 11/14] Use files: matcher --- .github/workflows/automerge.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 4cbc0baf..00e7fdca 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -28,8 +28,7 @@ jobs: id: changed uses: tj-actions/changed-files@v44 with: - dir_names: true - dir_names_include_files: | + files: | src/lib/seam/connect/routes/** merge: name: Merge From 80bbb32bdf1b73e51b058e6ae7c44e5137a7642f Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:22:42 -0700 Subject: [PATCH 12/14] Only close if is_generation_successful --- .github/workflows/automerge.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 00e7fdca..b8361601 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -15,7 +15,8 @@ jobs: permissions: checks: read outputs: - has_changes: ${{ steps.changed.outputs.any_changed == 'true' && steps.checks.outputs.conclusion == 'success'}} + has_changes: ${{ steps.changed.outputs.any_changed == 'true' }} + is_generation_successful: ${{ steps.checks.outputs.conclusion == 'success' }} steps: - name: Wait for checks uses: fountainhead/action-wait-for-check@v1.2.0 @@ -60,7 +61,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 needs: changes - if: needs.changes.outputs.has_changes == 'false' + if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful steps: - name: Close pull request # run: gh pr close "$PR_URL" From 7ea7aa4ba6e8e8b55a41110627a5b3618ad2628b Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:28:35 -0700 Subject: [PATCH 13/14] Fix if check --- .github/workflows/automerge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index b8361601..585fc8be 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -61,7 +61,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 needs: changes - if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful + if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful == 'true' steps: - name: Close pull request # run: gh pr close "$PR_URL" From 5329082056545a5f23ada0e6d8e934d603b050e5 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Tue, 2 Apr 2024 15:33:53 -0700 Subject: [PATCH 14/14] Only run for dependabot PRs --- .github/workflows/automerge.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 585fc8be..99610bf5 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -11,7 +11,7 @@ jobs: name: Get changes runs-on: ubuntu-latest timeout-minutes: 30 - # if: github.actor == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' permissions: checks: read outputs: @@ -51,11 +51,11 @@ jobs: env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GH_TOKEN }} - # - name: Merge pull request - # run: gh pr merge --auto --merge "$PR_URL" - # env: - # PR_URL: ${{ github.event.pull_request.html_url }} - # GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Merge pull request + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} close: name: Close runs-on: ubuntu-latest @@ -64,8 +64,7 @@ jobs: if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful == 'true' steps: - name: Close pull request - # run: gh pr close "$PR_URL" - run: 'true' + run: gh pr close "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GH_TOKEN }}