fix(cd): stop creating Deploy runs that can only skip, and write the rule down (#172)

Two grafts from #170, which found the same root cause independently while
#171 was in flight.

`branches: [main]` on the workflow_run trigger: a PR's CI is not a ship
signal, so filter it at the trigger instead of creating a Deploy run that
exists only to skip. Those skipped runs are what made the outage hard to
read — the deploy history looked busy while nothing shipped.

The CLAUDE.md rule is the point, though. The GITHUB_TOKEN no-cascade rule
biting one level deeper is not something the next person will re-derive from
a green CI badge and a stale site, and this class already cost two sessions
independently. Also records that "merged" is not "live" — the check that
would have caught it in seconds.

Credit to #170 for both.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-08-05 18:07:05 +00:00
1 parent b9f725f824
commit ab0dfd0b2e
2 files changed
+16

No files matched your search

+2
View File
@@ -21,6 +21,8 @@ on:
workflow_run:
workflows: ["CI"] # the job in ci.yml
types: [completed]
branches: [main] # a PR's CI is not a ship signal — filter it out
# here rather than creating a run that only skips
# Ships whatever is on main right now. Required, not a convenience: a CI run
# that GITHUB_TOKEN started (the auto-merge re-arm) emits NO workflow_run
# event, so the chain above never fires for an auto-merged PR — observed
+14
View File
@@ -248,6 +248,20 @@ before changing anything here.
- The CD re-arm at the end of the sweep is load-bearing: a push made with the
default `GITHUB_TOKEN` does not trigger workflows, so without it merges land
and silently never deploy. `ci.yml` carries `workflow_dispatch` for this.
- **The `GITHUB_TOKEN` no-cascade rule applies one level deeper than you
expect.** The re-armed CI run is *itself* `GITHUB_TOKEN`-created, so its
completion fires no `workflow_run` event either. Anything that listens for CI
therefore never wakes on an automated merge. Observed 2026-08-05: three PRs
merged onto a green `main` and zero Deploy runs were created — invisible,
because CI itself ran and went green.
- **Deployment is a reconciler, not a trigger.** Each sweep compares `main`'s tip
against the last successful Deploy and dispatches `deploy.yml` directly when
they differ, so a deploy that never fired *or* failed is retried next sweep
instead of sitting merged-but-not-live. Never add a workflow that only
triggers on `workflow_run` of CI and assume automated merges reach it — give
it `workflow_dispatch` and drive it from the sweep.
- **After merging, confirm the commit is LIVE, not just merged.** Green CI plus
a merge is not a deploy; check the running site.
## Dev Commands