Skip to content

Commit 44659bf

Browse files
Merge pull request #8 from OpenSyndrome/add-latest-json
Add update-latest-schema job
2 parents fb8e54c + 1799a53 commit 44659bf

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/validate_schema.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ "main" ]
88

99
jobs:
10-
build:
10+
validate:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
@@ -17,3 +17,21 @@ jobs:
1717
node-version: 20.x
1818
- run: npm install -g ajv-cli ajv-formats
1919
- run: ajv compile --spec draft2020 -c ajv-formats -s schemas/**/schema.json
20+
21+
update-latest-schema:
22+
runs-on: ubuntu-latest
23+
needs: validate
24+
if: github.event_name == 'push'
25+
permissions:
26+
contents: write
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Overwrite latest.json
30+
run: cp schemas/v1/schema.json schemas/latest.json
31+
- name: Commit schema changes (if any) to latest.json
32+
uses: stefanzweifel/git-auto-commit-action@v7
33+
id: auto-commit-action
34+
if: steps.auto-commit-action.outputs.changes_detected == 'true'
35+
with:
36+
commit_message: "Update latest.json from v1/schema.json"
37+
file_pattern: schemas/latest.json

0 commit comments

Comments
 (0)