management-api-updated #226
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 Management API Docs | |
| on: | |
| repository_dispatch: | |
| types: [management-api-updated] | |
| workflow_dispatch: | |
| concurrency: | |
| group: sync-management-api-docs | |
| cancel-in-progress: false | |
| jobs: | |
| sync: | |
| name: Sync Management API Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Fetch OpenAPI spec | |
| working-directory: apps/docs | |
| run: pnpm fetch-openapi | |
| - name: Generate docs | |
| working-directory: apps/docs | |
| run: pnpm run generate:management-api-docs | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [[ -z "$(git status --porcelain --untracked-files=all -- apps/docs/content/docs/management-api/)" ]]; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No MDX changes detected" | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "MDX changes detected:" | |
| git status --short -- apps/docs/content/docs/management-api/ | |
| fi | |
| - name: Commit and push | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config user.email "prismabots@gmail.com" | |
| git config user.name "Prismo" | |
| git add apps/docs/content/docs/management-api/ | |
| git commit -m "chore(docs): sync management API documentation" | |
| git push "https://x-access-token:${{ secrets.BOT_TOKEN_DOCS_COMMIT }}@github.com/${{ github.repository }}.git" HEAD:${{ github.ref_name }} | |
| - name: Trigger Vercel deploy | |
| run: curl --fail -X POST "${{ secrets.VERCEL_DEPLOY_HOOK_URL }}" |