Update API Client #4
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 API Client | |
| on: | |
| schedule: | |
| - cron: "0 9 * * 1" # Monday 9am UTC | |
| workflow_dispatch: | |
| inputs: | |
| api_url: | |
| description: "API base URL to fetch OpenAPI spec from" | |
| default: "https://api.cnap.tech" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jdx/mise-action@v2 | |
| - name: Fetch OpenAPI spec | |
| run: | | |
| API_URL="${{ inputs.api_url || 'https://api.cnap.tech' }}" | |
| curl -fsSL "${API_URL}/v1/openapi.json" -o internal/api/openapi.json | |
| echo "Fetched spec from ${API_URL}/v1/openapi.json" | |
| - name: Regenerate client | |
| run: task generate | |
| - name: Verify build | |
| run: task check | |
| - uses: peter-evans/create-pull-request@v7 | |
| with: | |
| branch: chore/update-api-client | |
| commit-message: "chore: update OpenAPI spec and regenerate client" | |
| title: "chore: update OpenAPI spec and regenerate client" | |
| body: | | |
| Automated weekly update of the OpenAPI spec from the public API. | |
| - Fetched `/v1/openapi.json` | |
| - Regenerated `client.gen.go` via `oapi-codegen` | |
| - Verified `task check` passes | |
| delete-branch: true |