Update OpenAPI Spec #274
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 Spec | |
| on: | |
| # Run once daily at 00:00 UTC | |
| schedule: | |
| - cron: '0 0 * * *' | |
| # Allow manual triggering | |
| workflow_dispatch: | |
| # Add a repository_dispatch event for external triggers if needed | |
| repository_dispatch: | |
| types: [openapi_spec_updated] | |
| jobs: | |
| update-openapi-spec: | |
| name: Update OpenAPI Spec | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write # Needed to apply labels when creating a PR | |
| steps: | |
| - name: Checkout code | |
| uses: actions/[email protected] | |
| with: | |
| # For PRs, check out the head of the PR | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.3' | |
| check-latest: true | |
| - name: Install mage | |
| run: go install github.com/magefile/mage@latest | |
| - name: Update OpenAPI spec | |
| id: update-spec | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.INTERNAL_REPO_TOKEN }} | |
| run: | | |
| mage openapi:update | |
| # Check if there are changes | |
| if [[ -n "$(git status --porcelain openapi-spec.yaml)" ]]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| # Create a new PR with changes | |
| - name: Create Pull Request | |
| if: steps.update-spec.outputs.changes == 'true' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| commit-message: 'chore: update OpenAPI spec' | |
| title: 'chore: update OpenAPI spec' | |
| body: | | |
| This PR updates the OpenAPI spec to the latest version. | |
| This is an automated PR created by the GitHub Actions workflow. | |
| branch: update-openapi-spec | |
| base: main | |
| labels: dependencies,automated |