Skip to content

Commit e7898bc

Browse files
authored
chore(ci): add notify-canary.yml dispatcher (#11)
1 parent 0370eb2 commit e7898bc

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# DISPATCHER TEMPLATE — copy this into each source-component repo
2+
# (rendezvous, web4, etc.) as .github/workflows/notify-canary.yml.
3+
#
4+
# What it does: on push to ANY branch, it tells pilot-canary to rebuild
5+
# itself with THIS branch for THIS component, plus latest-stable for
6+
# everything else.
7+
#
8+
# Setup steps for each source repo:
9+
# 1. Drop this file into the repo at .github/workflows/notify-canary.yml
10+
# 2. Edit `component:` below to match this repo's name in pilot-canary's
11+
# resolve step (rendezvous, web4, etc.)
12+
# 3. Add a repo secret `CANARY_DISPATCH_TOKEN`:
13+
# gh secret set CANARY_DISPATCH_TOKEN --repo <this-repo> \
14+
# --body "$(security find-generic-password -s github-openclaw-pat -a $USER -w)"
15+
# (matthew-pilot's PAT has the `repo` + `workflow` scopes needed)
16+
#
17+
# That's it. Every push fires a canary rebuild.
18+
19+
name: Notify canary of changes
20+
21+
on:
22+
push:
23+
branches: ['**']
24+
pull_request:
25+
branches: ['**']
26+
27+
# Workflow-level default — least privilege. This workflow only reads
28+
# the repo and dispatches an external event using its own PAT secret.
29+
permissions:
30+
contents: read
31+
32+
jobs:
33+
dispatch:
34+
runs-on: ubuntu-latest
35+
steps:
36+
# The dispatch step requires CANARY_DISPATCH_TOKEN to be set as a
37+
# repo secret (see header). Until an operator runs the `gh secret set`,
38+
# treat "secret absent" as a skip, not a failure — this workflow runs
39+
# on every PR and push, so a hard fail here would gate the entire
40+
# check rollup on a credential that's intentionally not committed.
41+
- name: Check token presence
42+
id: token_check
43+
env:
44+
TOKEN: ${{ secrets.CANARY_DISPATCH_TOKEN }}
45+
run: |
46+
if [ -z "${TOKEN}" ]; then
47+
echo "::notice::CANARY_DISPATCH_TOKEN not set in repo secrets — skipping canary dispatch"
48+
echo "have_token=false" >> "$GITHUB_OUTPUT"
49+
else
50+
echo "have_token=true" >> "$GITHUB_OUTPUT"
51+
fi
52+
53+
- name: Dispatch repository_dispatch to pilot-canary
54+
if: steps.token_check.outputs.have_token == 'true'
55+
env:
56+
GH_TOKEN: ${{ secrets.CANARY_DISPATCH_TOKEN }}
57+
# CHANGE THIS to match your component name in pilot-canary's resolve step
58+
COMPONENT: runtime
59+
REF: ${{ github.head_ref || github.ref_name }}
60+
run: |
61+
set -euo pipefail
62+
echo "Dispatching: component=$COMPONENT ref=$REF"
63+
gh api -X POST /repos/pilot-protocol/pilot-canary/dispatches \
64+
-f event_type=component-changed \
65+
-f client_payload[component]="$COMPONENT" \
66+
-f client_payload[ref]="$REF" \
67+
-f client_payload[source_repo]="${{ github.repository }}" \
68+
-f client_payload[source_sha]="${{ github.sha }}"

0 commit comments

Comments
 (0)