Update OpenAPI Specs - f489c4b279b09db2462015ad0ef13e559dfe8eb5 #48
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 OpenAPI Specs | |
| run-name: Update OpenAPI Specs - ${{ github.event.client_payload.sha }} | |
| on: | |
| repository_dispatch: | |
| types: [openapi_schema_generated] | |
| jobs: | |
| update-openapi-specs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Write Schema to File | |
| env: | |
| SCHEMA: ${{ toJSON(github.event.client_payload.schema) }} | |
| run: | | |
| echo "$SCHEMA" > openapi.json | |
| - name: Install Dependencies | |
| run: | | |
| npm install -g @redocly/cli | |
| # Verify that only valid OpenAPI schemas get committed | |
| - name: Lint OpenAPI Schema | |
| run: | | |
| redocly lint openapi.json | |
| - name: Commit and Push Changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| git add openapi.json | |
| commit_message="docs: update OpenAPI schema for ${{ github.event.client_payload.sha }}" | |
| if ! git diff --cached --exit-code; then | |
| git commit -m "$commit_message" | |
| git push | |
| fi |