Skip to content
69 changes: 28 additions & 41 deletions .github/workflows/update_speakeasy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ on:
required: true
type: string
targets:
description: 'Targets to update. If not provided, all targets will be updated.'
description: 'Targets to update.'
required: true
type: choice
options:
- mistralai-sdk
- mistralai-azure-sdk
- mistralai-gcp-sdk
- all

jobs:
update-sdks:
Expand All @@ -40,16 +42,25 @@ jobs:

- name: Install dependencies
run: |
cp README.md README-PYPI.md
poetry install --with dev

- name: Install Speakeasy CLI
run: |
curl -fsSL https://go.speakeasy.com/cli-install.sh | sh
speakeasy --version

- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git config --local --type bool push.autoSetupRemote true

- name: Create branch
run: |
git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-${{ github.run_id }}
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-$TIMESTAMP

- name: Update Speakeasy SDKs
run: |
Expand All @@ -62,6 +73,8 @@ jobs:
poetry run inv update-speakeasy \
--version "${{ github.event.inputs.version }}" \
$TARGETS_ARGS
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}

- name: Check for changes
id: check-changes
Expand All @@ -79,48 +92,22 @@ jobs:
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 }}
git commit -m "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}"
git push origin update-speakeasy-to-${{ github.event.inputs.version }}-${{ env.TIMESTAMP }}

- 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 }}
run: |
gh pr create \
--base main \
--head update-speakeasy-to-${{ github.event.inputs.version }}-${{ env.TIMESTAMP }} \
--title "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}" \
--body "This PR updates the Speakeasy SDKs to version ${{ github.event.inputs.version }}. It was automatically generated by the [Update Speakeasy workflow](.github/workflows/update_speakeasy.yaml)." \
--label automated \
--label speakeasy-update \
--assignee ${{ github.actor }}
env:
GITHUB_TOKEN: ${{ secrets.SPEAKEASY_WORKFLOW_GITHUB_PAT }}

- name: Comment on workflow run
if: steps.check-changes.outputs.has_changes == 'false'
Expand Down
Loading