-
Notifications
You must be signed in to change notification settings - Fork 150
Speakeasy update workflow #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
81dbce5
Add the update_speakeasy.py script
amenasria d6595dd
Fix linter errors
amenasria 0a58d64
Make it an invoke task
amenasria 2e4b747
Rename scripts/update_speakeasy.py -> utils/speakeasy.py
amenasria 26cd011
Add GHA Workflow
amenasria 1f877f4
Add missing permissions
amenasria e87c12e
Revert python >= 3.10
amenasria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pyproject.toml | ||
examples/* | ||
/utils/* | ||
src/mistral/extra/* | ||
pylintrc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
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. If not provided, all targets will be updated.' | ||
type: choice | ||
options: | ||
- mistralai-sdk | ||
- mistralai-azure-sdk | ||
- mistralai-gcp-sdk | ||
|
||
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: | | ||
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 }}." | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.