Update API Documentation #70
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 API Documentation | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight | |
| workflow_dispatch: # Allow manual triggers | |
| jobs: | |
| update-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Fetch latest schema | |
| run: npm run fetch-schema | |
| - name: Check for changes in schema | |
| id: check-changes | |
| run: | | |
| if git diff --quiet schema.graphql; then | |
| echo "No changes detected in schema" | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected in schema" | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate documentation | |
| if: steps.check-changes.outputs.changes_detected == 'true' | |
| run: npm run generate-docs | |
| - name: Build site | |
| if: steps.check-changes.outputs.changes_detected == 'true' | |
| run: npm run build | |
| - name: Commit and push changes | |
| if: steps.check-changes.outputs.changes_detected == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add schema.graphql public/ | |
| git commit -m "Update API documentation based on schema changes [skip ci]" | |
| git push |