Browse Source

Automate schema regeneration through CI (#1083)

Automates updating the JSON schemas as in
https://github.com/dora-rs/dora/pull/1080
pull/1086/head
Philipp Oppermann GitHub 6 months ago
parent
commit
bafd25f789
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 0 deletions
  1. +40
    -0
      .github/workflows/regenerate-schemas.yml

+ 40
- 0
.github/workflows/regenerate-schemas.yml View File

@@ -0,0 +1,40 @@
name: Regenerate JSON schemas

on:
push:
branches: ["main"]

jobs:
regenerate_schemas:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: r7kamura/rust-problem-matchers@v1.1.0
- run: cargo --version --verbose

- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Update Schema
run: cargo run -p dora-core --bin generate_schema
- name: Create if changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git diff --exit-code -- libraries/core/dora-schema.json; then
echo "Schema file was not changed"
else
git switch -c schema-update-for-${{ github.sha }}
git add libraries/core/dora-schema.json
git config user.email "dora-bot@phil-opp.com"
git config user.name "Dora Bot"
git commit -m "Update JSON schema for \`dora-core\`"
git push -u origin HEAD
git fetch origin main
gh pr create --fill
fi

Loading…
Cancel
Save