Skip to content

Commit 84915fc

Browse files
authored
Speakeasy update workflow fix (#259)
1 parent 864ceca commit 84915fc

File tree

1 file changed

+28
-41
lines changed

1 file changed

+28
-41
lines changed

.github/workflows/update_speakeasy.yaml

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ on:
1212
required: true
1313
type: string
1414
targets:
15-
description: 'Targets to update. If not provided, all targets will be updated.'
15+
description: 'Targets to update.'
16+
required: true
1617
type: choice
1718
options:
1819
- mistralai-sdk
1920
- mistralai-azure-sdk
2021
- mistralai-gcp-sdk
22+
- all
2123

2224
jobs:
2325
update-sdks:
@@ -40,16 +42,25 @@ jobs:
4042

4143
- name: Install dependencies
4244
run: |
45+
cp README.md README-PYPI.md
4346
poetry install --with dev
4447
48+
- name: Install Speakeasy CLI
49+
run: |
50+
curl -fsSL https://go.speakeasy.com/cli-install.sh | sh
51+
speakeasy --version
52+
4553
- name: Configure Git
4654
run: |
4755
git config --local user.email "[email protected]"
4856
git config --local user.name "GitHub Action"
57+
git config --local --type bool push.autoSetupRemote true
4958
5059
- name: Create branch
5160
run: |
52-
git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-${{ github.run_id }}
61+
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
62+
echo "TIMESTAMP=$TIMESTAMP" >> $GITHUB_ENV
63+
git checkout -b update-speakeasy-to-${{ github.event.inputs.version }}-$TIMESTAMP
5364
5465
- name: Update Speakeasy SDKs
5566
run: |
@@ -62,6 +73,8 @@ jobs:
6273
poetry run inv update-speakeasy \
6374
--version "${{ github.event.inputs.version }}" \
6475
$TARGETS_ARGS
76+
env:
77+
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
6578

6679
- name: Check for changes
6780
id: check-changes
@@ -79,48 +92,22 @@ jobs:
7992
if: steps.check-changes.outputs.has_changes == 'true'
8093
run: |
8194
git add .
82-
git commit -m "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}
83-
84-
Targets updated: ${{ github.event.inputs.targets }}
85-
86-
This PR was automatically generated by the Update Speakeasy workflow."
87-
git push origin ${{ github.event.inputs.branch_name }}
95+
git commit -m "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}"
96+
git push origin update-speakeasy-to-${{ github.event.inputs.version }}-${{ env.TIMESTAMP }}
8897
8998
- name: Create Pull Request
9099
if: steps.check-changes.outputs.has_changes == 'true'
91-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
92-
with:
93-
token: ${{ secrets.GITHUB_TOKEN }}
94-
base: main
95-
branch: ${{ github.event.inputs.branch_name }}
96-
title: "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}"
97-
body: |
98-
## Summary
99-
100-
This PR updates the Speakeasy SDKs to version `${{ github.event.inputs.version }}`.
101-
102-
## Changes
103-
104-
- **Version**: Updated to `${{ github.event.inputs.version }}`
105-
- **Targets**: ${{ github.event.inputs.targets }}
106-
107-
## Files Updated
108-
109-
The following SDK files have been regenerated:
110-
- Generated SDK code files
111-
- Updated dependencies and configurations
112-
113-
## How to Review
114-
115-
1. Check that the generated files look correct
116-
2. Verify that the version update is appropriate
117-
3. Ensure all target SDKs are properly updated
118-
119-
---
120-
121-
*This PR was automatically generated by the [Update Speakeasy workflow](.github/workflows/update_speakeasy.yaml)*
122-
labels: automated
123-
assignees: ${{ github.actor }}
100+
run: |
101+
gh pr create \
102+
--base main \
103+
--head update-speakeasy-to-${{ github.event.inputs.version }}-${{ env.TIMESTAMP }} \
104+
--title "Update Speakeasy SDKs to version ${{ github.event.inputs.version }}" \
105+
--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)." \
106+
--label automated \
107+
--label speakeasy-update \
108+
--assignee ${{ github.actor }}
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.SPEAKEASY_WORKFLOW_GITHUB_PAT }}
124111

125112
- name: Comment on workflow run
126113
if: steps.check-changes.outputs.has_changes == 'false'

0 commit comments

Comments
 (0)