Update Speakeasy SDKs #2
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 Speakeasy SDKs | |
| permissions: | |
| checks: write | |
| contents: write | |
| pull-requests: write | |
| statuses: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Speakeasy version to update to (e.g., 1.580.2)' | |
| required: true | |
| type: string | |
| targets: | |
| description: 'Targets to update.' | |
| required: true | |
| type: choice | |
| options: | |
| - mistralai-sdk | |
| - mistralai-azure-sdk | |
| - mistralai-gcp-sdk | |
| - all | |
| jobs: | |
| update-sdks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Install dependencies | |
| run: | | |
| cp README.md README-PYPI.md | |
| poetry install --with dev | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| - name: Create branch | |
| run: | | |
| git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-${{ github.run_id }} | |
| - name: Update Speakeasy SDKs | |
| run: | | |
| # Split targets and build command with multiple --targets flags | |
| TARGETS_ARGS="" | |
| for target in ${{ github.event.inputs.targets }}; do | |
| TARGETS_ARGS="$TARGETS_ARGS --targets $target" | |
| done | |
| poetry run inv update-speakeasy \ | |
| --version "${{ github.event.inputs.version }}" \ | |
| $TARGETS_ARGS | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "Files changed:" | |
| git status --porcelain | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected" | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check-changes.outputs.has_changes == 'true' | |
| run: | | |
| git add . | |
| git commit -m "Update Speakeasy SDKs to version ${{ github.event.inputs.version }} | |
| Targets updated: ${{ github.event.inputs.targets }} | |
| This PR was automatically generated by the Update Speakeasy workflow." | |
| git push origin ${{ github.event.inputs.branch_name }} | |
| - name: Create Pull Request | |
| if: steps.check-changes.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| base: main | |
| branch: ${{ github.event.inputs.branch_name }} | |
| title: "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}" | |
| body: | | |
| ## Summary | |
| This PR updates the Speakeasy SDKs to version `${{ github.event.inputs.version }}`. | |
| ## Changes | |
| - **Version**: Updated to `${{ github.event.inputs.version }}` | |
| - **Targets**: ${{ github.event.inputs.targets }} | |
| ## Files Updated | |
| The following SDK files have been regenerated: | |
| - Generated SDK code files | |
| - Updated dependencies and configurations | |
| ## How to Review | |
| 1. Check that the generated files look correct | |
| 2. Verify that the version update is appropriate | |
| 3. Ensure all target SDKs are properly updated | |
| --- | |
| *This PR was automatically generated by the [Update Speakeasy workflow](.github/workflows/update_speakeasy.yaml)* | |
| labels: automated | |
| assignees: ${{ github.actor }} | |
| - name: Comment on workflow run | |
| if: steps.check-changes.outputs.has_changes == 'false' | |
| run: | | |
| echo "No changes were detected. The SDKs are already up to date with version ${{ github.event.inputs.version }}." |