Skip to content

Commit 21d7766

Browse files
razor-xseambot
andauthored
Add dependabot and automerge support (#71)
* Remove TS warning * Throw error if missing new generated endpoints * Add dependabot and automerge support * Test automerge * ci: Format code * Fix PR number in workflow * Update checkName * Update checkName * Remove number from job name * Fix run cmd * Use files: matcher * Only close if is_generation_successful * Fix if check * Only run for dependabot PRs --------- Co-authored-by: Seam Bot <devops@getseam.com>
1 parent 341601d commit 21d7766

File tree

5 files changed

+102
-9
lines changed

5 files changed

+102
-9
lines changed

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: npm
5+
directory: '/'
6+
schedule:
7+
interval: daily
8+
commit-message:
9+
prefix: feat
10+
include: scope
11+
allow:
12+
- dependency-type: production
13+
ignore:
14+
- dependency-name: '*'
15+
update-types:
16+
- 'version-update:semver-major'
17+
groups:
18+
seam:
19+
dependency-type: development
20+
patterns:
21+
- '@seamapi/types'
22+
update-types:
23+
- patch
24+
- minor

.github/workflows/automerge.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Automerge
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
changes:
11+
name: Get changes
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
if: github.actor == 'dependabot[bot]'
15+
permissions:
16+
checks: read
17+
outputs:
18+
has_changes: ${{ steps.changed.outputs.any_changed == 'true' }}
19+
is_generation_successful: ${{ steps.checks.outputs.conclusion == 'success' }}
20+
steps:
21+
- name: Wait for checks
22+
uses: fountainhead/action-wait-for-check@v1.2.0
23+
id: checks
24+
with:
25+
checkName: Generate code
26+
ref: ${{ github.event.pull_request.head.sha }}
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Get changed generated files
29+
id: changed
30+
uses: tj-actions/changed-files@v44
31+
with:
32+
files: |
33+
src/lib/seam/connect/routes/**
34+
merge:
35+
name: Merge
36+
runs-on: ubuntu-latest
37+
timeout-minutes: 30
38+
needs: changes
39+
if: needs.changes.outputs.has_changes == 'true'
40+
steps:
41+
- name: Get changed files
42+
id: changed-files
43+
uses: tj-actions/changed-files@v44
44+
with:
45+
files_separator: ' '
46+
dir_names: true
47+
dir_names_include_files: |
48+
src/lib/seam/connect/routes/**
49+
- name: Approve pull request
50+
run: gh pr review --approve "$PR_URL"
51+
env:
52+
PR_URL: ${{ github.event.pull_request.html_url }}
53+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
54+
- name: Merge pull request
55+
run: gh pr merge --auto --merge "$PR_URL"
56+
env:
57+
PR_URL: ${{ github.event.pull_request.html_url }}
58+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
59+
close:
60+
name: Close
61+
runs-on: ubuntu-latest
62+
timeout-minutes: 30
63+
needs: changes
64+
if: needs.changes.outputs.has_changes == 'false' && needs.changes.outputs.is_generation_successful == 'true'
65+
steps:
66+
- name: Close pull request
67+
run: gh pr close "$PR_URL"
68+
env:
69+
PR_URL: ${{ github.event.pull_request.html_url }}
70+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

generate-routes.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ const createRoutes = (): Route[] => {
127127
)
128128

129129
if (unmatchedEndpointPaths.length > 0) {
130-
// eslint-disable-next-line no-console
131-
console.warn(
132-
`The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n${unmatchedEndpointPaths.join(
130+
throw new Error(
131+
`The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n\n${unmatchedEndpointPaths.join(
133132
'\n',
134-
)}`,
133+
)}\n`,
135134
)
136135
}
137136

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,6 @@
127127
"tsx": "^4.6.2",
128128
"type-fest": "^4.3.1",
129129
"typedoc": "^0.25.2",
130-
"typescript": "^5.1.0"
130+
"typescript": "~5.3.0"
131131
}
132132
}

0 commit comments

Comments
 (0)