Repository navigation
Refresh OpenAPI spec #6
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: Refresh OpenAPI spec | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: refresh-openapi | |
| cancel-in-progress: false | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Fetch the live spec | |
| run: | | |
| curl -fsS --retry 3 https://roxyapi.com/api/v2/openapi.json -o fetched.json | |
| jq -e '.openapi and (.paths | length > 0)' fetched.json > /dev/null | |
| mv fetched.json openapi.json | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Regenerate the README regions from the spec | |
| run: bun scripts/sync-readme.ts | |
| - name: Commit when changed | |
| run: | | |
| if git diff --quiet -- openapi.json README.md; then | |
| echo 'spec and README unchanged' | |
| exit 0 | |
| fi | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add openapi.json README.md | |
| git commit -m 'Update openapi.json and README from the live spec' | |
| git push |