Skip to content

Commit ee14a94

Browse files
Merge pull request #62 from gleanwork/rwjblue/code-sample-generation-action
feat(ci): Add workflow to auto-trigger code sample generation
2 parents 8dea625 + e13be68 commit ee14a94

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Auto-trigger Code Samples Generation
2+
3+
on:
4+
# Allow manual trigger for testing
5+
workflow_dispatch:
6+
7+
# Triggered by client repos after they release
8+
repository_dispatch:
9+
types: [client-released]
10+
11+
concurrency:
12+
group: auto-trigger-code-samples
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
actions: write
18+
19+
jobs:
20+
check-and-trigger:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up mise
27+
uses: jdx/mise-action@v2
28+
with:
29+
cache: true
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile --ignore-scripts
35+
36+
- name: Check if all client releases have matching SHAs
37+
id: check
38+
run: |
39+
if pnpm run check-client-releases; then
40+
echo "ready=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "ready=false" >> $GITHUB_OUTPUT
43+
fi
44+
45+
- name: Trigger generate-code-samples workflow
46+
if: steps.check.outputs.ready == 'true'
47+
run: |
48+
gh workflow run generate-code-samples.yml
49+
echo "✅ Successfully triggered generate-code-samples.yml workflow"
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Log status when not ready
54+
if: steps.check.outputs.ready != 'true'
55+
run: |
56+
echo "⏳ Waiting for all API client releases to sync"
57+
echo "Workflow will trigger generate-code-samples.yml automatically when all releases are ready"

0 commit comments

Comments
 (0)