-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 2.03 KB
/
Copy pathspec-sync.yml
File metadata and controls
56 lines (52 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Keep the committed OpenAPI spec artifacts in sync with the Zod schemas they are
# generated from. The served specs (lib/openapi/generated-spec.ts, returned by
# GET /api/spec.yaml, and lib/openapi/generated.json, returned by /openapi.json)
# plus lib/openapi/generated.yaml are produced by `npm run gen:spec` from the
# registry in lib/{docs,auth}/{schemas,paths}.ts.
# This job regenerates them whenever the schemas/paths/generator change and
# commits the result if it drifted, so the served spec can never lag the schemas.
# This is a CONTENT-SYNC job, not a deploy — production deploys come from the
# Vercel↔GitHub git integration. (Mirrors skill-sync.yml.)
name: spec-sync
on:
push:
branches: [main]
paths:
- lib/docs/schemas.ts
- lib/docs/paths.ts
- lib/auth/schemas.ts
- lib/auth/paths.ts
- lib/openapi/registry.ts
- scripts/gen-spec.ts
- .github/workflows/spec-sync.yml
permissions:
contents: write
# Avoid overlapping runs racing to commit.
concurrency:
group: spec-sync
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Regenerate the spec artifacts
run: npm run gen:spec
- name: Commit if changed
run: |
if git diff --quiet -- lib/openapi/generated.yaml lib/openapi/generated.json lib/openapi/generated-spec.ts; then
echo "Spec artifacts already in sync."
exit 0
fi
git config user.name "justhtml-bot"
git config user.email "noreply@anthropic.com"
git add lib/openapi/generated.yaml lib/openapi/generated.json lib/openapi/generated-spec.ts
# The push only touches lib/openapi/generated*, which are NOT in this
# workflow's path filter, so it will not re-trigger the job (no loop).
git commit -m "spec-sync: regenerate the OpenAPI spec from the Zod schemas"
git push