Skip to content

Commit 406e7bb

Browse files
feat: add CI job to validate JSON schema generation (#139)
Add a new validate-schemas job to the CI workflow that ensures the committed JSON schemas in the schemas/ directory are up-to-date with the schema generation script. This prevents drift between the source code and generated schemas. The job: - Runs the schema generation script (yarn build:schema) - Checks if any schemas were modified - Fails if changes are detected, prompting developers to regenerate and commit the schemas 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 82b12a4 commit 406e7bb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,32 @@ jobs:
3939
run: yarn build
4040
- name: Test
4141
run: yarn lint && yarn test
42+
43+
validate-schemas:
44+
name: Validate JSON Schemas
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
- name: Setup Node.js
50+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
51+
with:
52+
node-version: "22.17.x"
53+
cache: "yarn"
54+
- name: Install dependencies
55+
run: yarn install --immutable
56+
- name: Build code (required for schema generation)
57+
run: yarn build:code
58+
- name: Generate schemas
59+
run: yarn build:schema
60+
- name: Check for schema changes
61+
run: |
62+
if ! git diff --exit-code schemas/; then
63+
echo "Error: JSON schemas in schemas/ directory are out of sync!"
64+
echo "Please run 'yarn build:schema' and commit the changes."
65+
echo ""
66+
echo "Changes detected:"
67+
git diff schemas/
68+
exit 1
69+
fi
70+
echo "✓ All schemas are up to date"

0 commit comments

Comments
 (0)