Skip to content

Commit e13be68

Browse files
committed
feat(ci): Add workflow to auto-trigger code sample generation
Creates a GitHub Actions workflow that automatically triggers `generate-code-samples.yml` when all 4 API client repos have matching SHAs. Eliminates a manual step from the deployment pipeline. The workflow: - Listens for repository_dispatch events from client repos - Runs check-client-releases to verify SHA synchronization - Triggers generate-code-samples.yml when all repos match Setup: Add this step to each client repo's release workflow: ``` - name: Notify open-api repo of release if: success() run: | gh api repos/gleanwork/open-api/dispatches \ -X POST \ -H "Accept: application/vnd.github+json" \ -f event_type=client-released \ -f client_payload[repo]=${{ github.repository }} \ -f client_payload[version]=${{ github.ref_name }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ```
1 parent d2e771e commit e13be68

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)