Generate SDK #602
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: Generate SDK | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 12 * * *" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate-client: | |
| runs-on: ubuntu-latest | |
| name: Generate Python SDK | |
| steps: | |
| - uses: actions/create-github-app-token@v1 | |
| id: generate-token | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Install Poetry # Used in the generate.sh script | |
| uses: abatilo/actions-poetry@v2 | |
| with: | |
| poetry-version: "2.2.1" | |
| - name: Install cog, requests for testing | |
| run: pip install requests==2.32.5 cogapp==3.6.0 | |
| - uses: actions/checkout@v4 | |
| - name: Generate new sdk | |
| id: generate | |
| run: ${{ github.workspace }}/scripts/generate.sh | |
| - name: Get current date | |
| if: steps.generate.outputs.changes == 'true' | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT | |
| - name: Create Pull Request | |
| if: steps.generate.outputs.changes == 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| branch: update-sdk | |
| author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
| delete-branch: true | |
| labels: bot | |
| title: "Update Python SDK" | |
| commit-message: "[bot](${{ steps.date.outputs.date }}) Sync SDK with OpenAPI spec" | |
| body: "New [API](https://api.vulncheck.com/v3/openapi) changes have been detected." |