Sync README OpenAPI #1052
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: Sync README OpenAPI | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "17,47 * * * *" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: sync-readme-openapi | |
| cancel-in-progress: false | |
| jobs: | |
| sync-readme-openapi: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Update README API list | |
| env: | |
| OPENAPI_API_KEY: ${{ secrets.OPENAPI_API_KEY }} | |
| JUSTSERPAPI_API_KEY: ${{ secrets.JUSTSERPAPI_API_KEY }} | |
| OPENAPI_BEARER_TOKEN: ${{ secrets.OPENAPI_BEARER_TOKEN }} | |
| OPENAPI_TOKEN: ${{ secrets.OPENAPI_TOKEN }} | |
| JUSTSERPAPI_BEARER_TOKEN: ${{ secrets.JUSTSERPAPI_BEARER_TOKEN }} | |
| OPENAPI_BASIC_AUTH_USER: ${{ secrets.OPENAPI_BASIC_AUTH_USER }} | |
| OPENAPI_BASIC_AUTH_PASS: ${{ secrets.OPENAPI_BASIC_AUTH_PASS }} | |
| OPENAPI_BASIC_AUTH_USERNAME: ${{ secrets.OPENAPI_BASIC_AUTH_USERNAME }} | |
| OPENAPI_BASIC_AUTH_PASSWORD: ${{ secrets.OPENAPI_BASIC_AUTH_PASSWORD }} | |
| run: node scripts/update-readme-api-list.mjs | |
| - name: Commit and push updated README | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git diff --cached --quiet && exit 0 | |
| git commit -m "chore: sync README API list" | |
| for attempt in 1 2 3 4 5; do | |
| git fetch origin main | |
| git rebase origin/main | |
| if git push origin HEAD:main; then | |
| exit 0 | |
| fi | |
| if [ "$attempt" -eq 5 ]; then | |
| echo "Failed to push README update after 5 attempts." >&2 | |
| exit 1 | |
| fi | |
| backoff_seconds=$((attempt * 2)) | |
| echo "Push attempt $attempt failed; retrying in ${backoff_seconds}s." | |
| sleep "$backoff_seconds" | |
| done |