Generate SDK and Open PR #53
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 and Open PR | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 12 * * 0' # Runs every Sunday at 12:00 UTC | |
| jobs: | |
| generate-sdk: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Install NSwag CLI | |
| run: npm install -g nswag | |
| - name: Install project dependencies | |
| run: npm install | |
| - name: Run SDK generation script | |
| run: sh ./generate_openapi.sh | |
| - name: Restore .NET tools | |
| run: dotnet tool restore | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if ! git diff --exit-code; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create a pull request | |
| if: steps.check_changes.outputs.changes == 'true' | |
| id: create_pr | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: "feat/sdk-update" | |
| branch-suffix: timestamp | |
| title: "OpenAPI SDK Update" | |
| body: "This PR updates the SDK based on the latest OpenAPI specifications." | |
| commit-message: "Update SDK from OpenAPI specs" | |
| - name: Output PR URL | |
| if: steps.create_pr.outputs.pull-request-url != '' | |
| run: | | |
| echo "Pull Request URL: ${{ steps.create_pr.outputs.pull-request-url }}" | |