Update Schema #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Schema | |
| on: | |
| schedule: | |
| # Run weekly on Sundays at 8:00 AM UTC | |
| - cron: '0 8 * * 0' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-schema: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate new schema | |
| run: npm run generate | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| if git diff --quiet dist/schema.json; then | |
| echo "has-changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has-changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check-changes.outputs.has-changes == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: 'Update OpenAPI schema' | |
| title: 'Update OpenAPI schema' | |
| body: | | |
| This PR was automatically generated by the weekly schema update workflow. | |
| The OpenAPI schema has been updated based on the latest Mastodon documentation. | |
| Please review the changes and merge if they look correct. | |
| branch: update-schema | |
| delete-branch: true |