Skip to content

Commit 26cd011

Browse files
committed
Add GHA Workflow
1 parent 2e4b747 commit 26cd011

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Update Speakeasy SDKs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Speakeasy version to update to (e.g., 1.580.2)'
8+
required: true
9+
type: string
10+
targets:
11+
description: 'Targets to update. If not provided, all targets will be updated.'
12+
type: choice
13+
options:
14+
- mistralai-sdk
15+
- mistralai-azure-sdk
16+
- mistralai-gcp-sdk
17+
18+
jobs:
19+
update-sdks:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Install Poetry
31+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
32+
with:
33+
version: latest
34+
virtualenvs-create: true
35+
virtualenvs-in-project: true
36+
37+
- name: Install dependencies
38+
run: |
39+
poetry install --with dev
40+
41+
- name: Configure Git
42+
run: |
43+
git config --local user.email "action@github.com"
44+
git config --local user.name "GitHub Action"
45+
46+
- name: Create branch
47+
run: |
48+
git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-${{ github.run_id }}
49+
50+
- name: Update Speakeasy SDKs
51+
run: |
52+
# Split targets and build command with multiple --targets flags
53+
TARGETS_ARGS=""
54+
for target in ${{ github.event.inputs.targets }}; do
55+
TARGETS_ARGS="$TARGETS_ARGS --targets $target"
56+
done
57+
58+
poetry run inv update-speakeasy \
59+
--version "${{ github.event.inputs.version }}" \
60+
$TARGETS_ARGS
61+
62+
- name: Check for changes
63+
id: check-changes
64+
run: |
65+
if [ -n "$(git status --porcelain)" ]; then
66+
echo "has_changes=true" >> $GITHUB_OUTPUT
67+
echo "Files changed:"
68+
git status --porcelain
69+
else
70+
echo "has_changes=false" >> $GITHUB_OUTPUT
71+
echo "No changes detected"
72+
fi
73+
74+
- name: Commit and push changes
75+
if: steps.check-changes.outputs.has_changes == 'true'
76+
run: |
77+
git add .
78+
git commit -m "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}
79+
80+
Targets updated: ${{ github.event.inputs.targets }}
81+
82+
This PR was automatically generated by the Update Speakeasy workflow."
83+
git push origin ${{ github.event.inputs.branch_name }}
84+
85+
- name: Create Pull Request
86+
if: steps.check-changes.outputs.has_changes == 'true'
87+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
88+
with:
89+
token: ${{ secrets.GITHUB_TOKEN }}
90+
base: main
91+
branch: ${{ github.event.inputs.branch_name }}
92+
title: "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}"
93+
body: |
94+
## Summary
95+
96+
This PR updates the Speakeasy SDKs to version `${{ github.event.inputs.version }}`.
97+
98+
## Changes
99+
100+
- **Version**: Updated to `${{ github.event.inputs.version }}`
101+
- **Targets**: ${{ github.event.inputs.targets }}
102+
103+
## Files Updated
104+
105+
The following SDK files have been regenerated:
106+
- Generated SDK code files
107+
- Updated dependencies and configurations
108+
109+
## How to Review
110+
111+
1. Check that the generated files look correct
112+
2. Verify that the version update is appropriate
113+
3. Ensure all target SDKs are properly updated
114+
115+
---
116+
117+
*This PR was automatically generated by the [Update Speakeasy workflow](.github/workflows/update_speakeasy.yaml)*
118+
labels: automated
119+
assignees: ${{ github.actor }}
120+
121+
- name: Comment on workflow run
122+
if: steps.check-changes.outputs.has_changes == 'false'
123+
run: |
124+
echo "No changes were detected. The SDKs are already up to date with version ${{ github.event.inputs.version }}."

0 commit comments

Comments
 (0)