Skip to content

Commit 5867c46

Browse files
Merge branch 'main' into brendan/sou-947-allow-sender-constraining-access-tokens-ex-dpop
2 parents 720f4c1 + a369cfb commit 5867c46

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Generate OpenAPI Spec
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
paths:
7+
- "packages/web/**"
8+
- "packages/shared/src/version.ts"
9+
10+
jobs:
11+
generate-openapi:
12+
runs-on: ubuntu-latest
13+
# Skip forks: the default GITHUB_TOKEN can't push back to a fork's branch.
14+
if: github.event.pull_request.head.repo.full_name == github.repository
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: "true"
22+
ref: ${{ github.head_ref }}
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Use Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20.x'
29+
cache: 'yarn'
30+
cache-dependency-path: '**/yarn.lock'
31+
32+
- name: Install
33+
run: yarn install --frozen-lockfile
34+
35+
- name: Generate OpenAPI spec
36+
run: yarn workspace @sourcebot/web openapi:generate
37+
38+
- name: Commit regenerated spec if changed
39+
run: |
40+
SPEC=docs/api-reference/sourcebot-public.openapi.json
41+
if [ -z "$(git status --porcelain "$SPEC")" ]; then
42+
echo "OpenAPI spec is up to date."
43+
exit 0
44+
fi
45+
git config user.name "github-actions[bot]"
46+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+
git add "$SPEC"
48+
git commit -m "chore: regenerate OpenAPI spec"
49+
git push

0 commit comments

Comments
 (0)