Skip to content

Commit a1b8377

Browse files
authored
Add workflow to run Speakeasy on PR spec changes (#13)
2 parents 8852a8e + 63b9858 commit a1b8377

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run Speakeasy on PR
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
paths:
11+
- .speakeasy/in.openapi.yaml
12+
13+
jobs:
14+
run-speakeasy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.pull_request.head.ref }}
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Setup Speakeasy
24+
uses: speakeasy-api/sdk-generation-action@v15
25+
with:
26+
speakeasy_version: latest
27+
28+
- name: Run Speakeasy
29+
run: speakeasy run
30+
31+
- name: Commit changes
32+
run: |
33+
git config --global user.name 'github-actions[bot]'
34+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
35+
git add .
36+
if git diff --staged --quiet; then
37+
echo "No changes to commit"
38+
else
39+
git commit -m "chore: run speakeasy and update generated files"
40+
git push
41+
fi
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)