Skip to content

Commit ff85a69

Browse files
GvieveGenevieve Nuebel
andauthored
Enable dispatch and remove dry-run logic (#182)
Co-authored-by: Genevieve Nuebel <genevieve.nuebel@mx.com>
1 parent d06b176 commit ff85a69

1 file changed

Lines changed: 30 additions & 42 deletions

File tree

.github/workflows/versioned-sdk-dispatch.yml

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Versioned SDK Dispatch
22

33
# Dispatches repository_dispatch to opted-in SDK repos when versioned OAS files change.
4-
# Currently in DRY RUN mode — logs what it would dispatch without sending anything.
5-
# See PR #XX for context. Replaces update.yml (now update.yml.bak).
64

75
on:
86
pull_request:
@@ -93,7 +91,7 @@ jobs:
9391
# Job: Dispatch to opted-in SDK repos (PR merge)
9492
# ──────────────────────────────────────────────────
9593
dispatch:
96-
name: "[DRY RUN] Dispatch to ${{ matrix.repo }}"
94+
name: Dispatch to ${{ matrix.repo }}
9795
needs: detect-changes
9896
if: needs.detect-changes.outputs.has_changes == 'true'
9997
runs-on: ubuntu-latest
@@ -108,25 +106,20 @@ jobs:
108106
# - mxenabled/mx-platform-csharp
109107
# - mxenabled/mx-platform-go
110108
steps:
111-
# ──────────────────────────────────────────────
112-
# DRY RUN: Replace this step with actual repository_dispatch in PR 2
113-
# ──────────────────────────────────────────────
114-
- name: "[DRY RUN] Would dispatch to ${{ matrix.repo }}"
115-
run: |
116-
echo "============================================"
117-
echo " DRY RUN — No dispatch sent"
118-
echo "============================================"
119-
echo ""
120-
echo "Repository: ${{ matrix.repo }}"
121-
echo "Event type: automated_push_to_master"
122-
echo "Version: ${{ needs.detect-changes.outputs.version }}"
123-
echo "Commit SHA: ${{ github.sha }}"
124-
echo "API versions: ${{ needs.detect-changes.outputs.api_versions }}"
125-
echo ""
126-
echo "Payload that would be sent:"
127-
echo ' {"version":"${{ needs.detect-changes.outputs.version }}","commit_sha":"${{ github.sha }}","api_versions":"${{ needs.detect-changes.outputs.api_versions }}"}'
128-
echo ""
129-
echo "============================================"
109+
- name: Generate GitHub App token
110+
id: app-token
111+
uses: tibdex/github-app-token@v1
112+
with:
113+
app_id: ${{ secrets.APP_ID }}
114+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
115+
116+
- name: Dispatch to ${{ matrix.repo }}
117+
uses: peter-evans/repository-dispatch@v2
118+
with:
119+
token: ${{ steps.app-token.outputs.token }}
120+
repository: ${{ matrix.repo }}
121+
event-type: automated_push_to_master
122+
client-payload: '{"version":"${{ needs.detect-changes.outputs.version }}","commit_sha":"${{ github.sha }}","api_versions":"${{ needs.detect-changes.outputs.api_versions }}"}'
130123

131124
- name: Slack notification
132125
uses: ravsamhq/notify-slack-action@v2
@@ -145,7 +138,7 @@ jobs:
145138
# Job: Manual dispatch (workflow_dispatch)
146139
# ──────────────────────────────────────────────────
147140
manual-dispatch:
148-
name: "[DRY RUN] Manual dispatch to ${{ matrix.repo }}"
141+
name: Manual dispatch to ${{ matrix.repo }}
149142
runs-on: ubuntu-latest
150143
if: github.event_name == 'workflow_dispatch'
151144
strategy:
@@ -154,25 +147,20 @@ jobs:
154147
- mxenabled/mx-platform-node
155148
# Add more repos here as they are migrated to multi-version support
156149
steps:
157-
# ──────────────────────────────────────────────
158-
# DRY RUN: Replace this step with actual repository_dispatch in PR 2
159-
# ──────────────────────────────────────────────
160-
- name: "[DRY RUN] Would dispatch to ${{ matrix.repo }}"
161-
run: |
162-
echo "============================================"
163-
echo " DRY RUN — No dispatch sent (manual)"
164-
echo "============================================"
165-
echo ""
166-
echo "Repository: ${{ matrix.repo }}"
167-
echo "Event type: automated_push_to_master"
168-
echo "Version: ${{ github.event.inputs.version_level }}"
169-
echo "Commit SHA: ${{ github.sha }}"
170-
echo "API versions: ${{ github.event.inputs.api_versions }}"
171-
echo ""
172-
echo "Payload that would be sent:"
173-
echo ' {"version":"${{ github.event.inputs.version_level }}","commit_sha":"${{ github.sha }}","api_versions":"${{ github.event.inputs.api_versions }}"}'
174-
echo ""
175-
echo "============================================"
150+
- name: Generate GitHub App token
151+
id: app-token
152+
uses: tibdex/github-app-token@v1
153+
with:
154+
app_id: ${{ secrets.APP_ID }}
155+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
156+
157+
- name: Dispatch to ${{ matrix.repo }}
158+
uses: peter-evans/repository-dispatch@v2
159+
with:
160+
token: ${{ steps.app-token.outputs.token }}
161+
repository: ${{ matrix.repo }}
162+
event-type: automated_push_to_master
163+
client-payload: '{"version":"${{ github.event.inputs.version_level }}","commit_sha":"${{ github.sha }}","api_versions":"${{ github.event.inputs.api_versions }}"}'
176164

177165
- name: Slack notification
178166
uses: ravsamhq/notify-slack-action@v2

0 commit comments

Comments
 (0)