Download OpenAPI Files and Update Config #69
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: Download OpenAPI Files and Update Config | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * 1" # Runs weekly at midnight on Monday | |
| jobs: | |
| update_openapi_and_config: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup bun | |
| uses: ./.github/actions/setup | |
| - name: Download OAS Files | |
| run: bun run src/cmd/download-oas.ts | |
| working-directory: scripts | |
| - name: Transform OAS Files | |
| run: bun run src/cmd/transform-oas.ts | |
| working-directory: scripts | |
| - name: Run checks on transforms | |
| run: bun run src/cmd/check.ts | |
| working-directory: scripts | |
| - name: Run writedocs api generation | |
| run: bunx writedocs@1.3.43 api --clean | |
| - name: Generate sidebar and add it to config.json | |
| run: bun run src/cmd/generate-menu.ts | |
| working-directory: scripts | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| id: cpr | |
| with: | |
| commit-message: "chore: update oas definitions" | |
| title: "chore: update oas definitions" | |
| body: "updated oas definitions" | |
| branch: "${{ steps.date.outputs.date }}-chore-codegen-update-oas" | |
| base: main | |
| - name: Enable Pull Request Automerge | |
| run: gh pr merge --squash --auto "${{ steps.cpr.outputs.pull-request-number }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: steps.cpr.outputs.pull-request-number |