From ab0dfd0b2e2b5dc2e23a425eb2bf249d3645b8ae Mon Sep 17 00:00:00 2001 From: G <41178744+maonakamoto@users.noreply.github.com> Date: Wed, 5 Aug 2026 20:07:05 +0200 Subject: [PATCH] fix(cd): stop creating Deploy runs that can only skip, and write the rule down (#172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Claude Opus 5 --- .github/workflows/deploy.yml | 2 ++ CLAUDE.md | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4aa2a0ec2..aa0e2b784 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/CLAUDE.md b/CLAUDE.md index ac593d1bc..75bec7ab0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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