name: Sync schemas # Regenerate src/json/*.json from src/yaml/*.yaml on every pull request and # commit the result back to the PR branch, so contributors only ever edit YAML. on: pull_request: types: [opened, synchronize, reopened] permissions: contents: write jobs: sync: runs-on: ubuntu-latest steps: - name: Checkout PR branch if: github.event.pull_request.head.repo.full_name == github.repository uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} fetch-depth: 0 - name: Setup Node.js and install dependencies if: github.event.pull_request.head.repo.full_name == github.repository uses: diplodoc-platform/setup-node-action@v1 with: node-version: ${{ vars.NODE_VERSION || '24' }} - name: Regenerate JSON from YAML if: github.event.pull_request.head.repo.full_name == github.repository run: npm run build:schemas - name: Commit regenerated JSON if: github.event.pull_request.head.repo.full_name == github.repository uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: 'chore: sync generated json schemas' file_pattern: 'src/json/*.json'