Repository navigation
fix(ci): pure event-driven auto-merge — zero polling, two reusable workflows - #15
Conversation
…e auto-merge GitHub's native enablePullRequestAutoMerge already waits for ALL required status checks through branch protection. The engine no longer polls check-runs, verifies green status, or re-implements GitHub's own merge gating. It only: 1. Finalizes the CHANGELOG placeholder (git operations) 2. Re-dispatches the validator on the new head (workflow_dispatch) 3. Enables native auto-merge (GraphQL mutation) 4. Polls for merge completion + tags (single Octokit loop) Removed: wait_for_validator bash function, wait_all_settled bash function, verify_all_green bash function — all replaced by GitHub's native auto-merge which handles check gating through branch protection.
The engine now consists of TWO reusable workflows: 1. auto-merge-reusable.yml — finalizes CHANGELOG, dispatches validator re-run on the new head, enables native auto-merge, and EXITS. GitHub's native enablePullRequestAutoMerge waits for ALL required status checks through branch protection — no polling needed. 2. tag-on-merge.yml — triggered by pull_request:closed when merged. Creates the CalVer release tag on the merge commit. Pure event-driven, no polling. Removed: all wait_for_validator / wait_all_settled / verify_all_green functions, all check-run polling loops, all sleep/timeout loops. Every action is triggered by a native GitHub event.
Every time pr-validator completes, the engine does a single check: 'Are ALL check runs on the PR head completed and green?' If yes → finalize CHANGELOG, enable native auto-merge, exit. If no → exit gracefully (next event will re-trigger). Zero loops, zero sleep, zero polling. Pure event-driven.
Review — BLOCKHead SHA: Change class: CI/workflow — 4 workflow files + 2 dispatcher templates. No code, no candies, no runtime packaging. Security screen: PASS. No T1–T4 findings. The rewrite preserves the validator gate: the new engine requires ALL check runs green before enabling native auto-merge, and native auto-merge waits for branch-protection-required checks. No secrets, no exfiltration, no scope mismatch (all 6 diff files are accounted for in the body's file table). Blocks
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
|
openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
…pletion Trigger: check_run: [completed] — fires EVERY TIME any check run completes on any branch. The engine checks ALL check runs on the PR head. If all green (including pr-validator) -> finalize CHANGELOG, enable native auto-merge, exit. If not -> exit — the next check_run re-triggers naturally. This handles the correct case: if pr-validator finishes first, the engine finds other checks pending and exits. When those other checks finally complete, check_run fires again and the engine re-checks. No polling, no sleep, no timeouts.
Review — BLOCKHead SHA: Change class: CI/workflow — 4 workflow files + 2 dispatcher templates. No code, no candies, no runtime packaging. Security screen: PASS. No T1–T4 findings. The rewrite preserves the validator gate: the new engine requires ALL check runs (including Blocks
Comment intake
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — BLOCKHead SHA: Change class: CI/workflow — 4 workflow files + 2 dispatcher templates + 1 CHANGELOG entry. No code, no candies, no runtime packaging. Security screen: PASS. No T1–T4 findings. The rewrite preserves the validator gate (engine requires ALL check runs green, including Blocks
Note: B19 (CHANGELOG) is now satisfied — Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
…lization Previously, every engine run after CHANGELOG finalization dispatched a new validator because 'stamp != empty' was always true (carried over from the previous run). Now 'fresh' is only set when this specific run performed the git mv+commit+push — subsequent runs skip dispatch.
Review — PASSHead SHA: Change class: CI/workflow — 4 workflow files + 2 dispatcher templates + 1 CHANGELOG entry. No code, no candies, no runtime packaging. Security screen: PASS. No T1–T4 findings. The rewrite preserves and strengthens the validator gate (engine requires ALL check runs green, including Checklist: All applicable rules PASS or NA. Prior reviewers' blockers were re-derived against the CURRENT head and are all resolved:
Comment intake:
Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS. No T1–T4 findings. This is a T4 self-modifying-security change (it rewrites the auto-merge engine that gates merges), so I gave it heightened review: the new engine strengthens the gate — it requires ALL check runs on the PR head green (including Checklist: All applicable rules PASS or NA. Prior reviewers' blockers were re-derived against the CURRENT head and are all resolved:
Comment intake:
Placement: CORRECT — the change is confined to Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
fix(ci): pure event-driven auto-merge — triggered by every check_run completion
The change
The auto-merge engine now triggers on EVERY completed check run
(
check_run: [completed]), not just the pr-validator. This is thecorrect event for "a check just finished — is it time to merge?"
The engine does a single non-looping check of ALL check runs on the PR
head:
check_runevent re-triggersThe validator re-dispatch is gated on
fresh=true— only the enginerun that performs the
git mv + commit + pushdispatches a newvalidator. Subsequent runs (triggered by that validator's completion)
see an already-finalized CHANGELOG and skip dispatch, preventing loops.
Companion:
tag-on-merge.yml— triggered bypull_request: [closed]when
merged: true. Creates the CalVer release tag on the mergecommit.
How tested
git mv+sedH1 rewrite +marker pattern proven live on distro-arch#17 (v2026.232.2103,
finalize correctly applied and tag minted at merge stamp) and
charly#363 (v2026.232.2126, same pattern).
enablePullRequestAutoMergevia GraphQL): provenlive on .github PR fix(ci): replace per-repo inline auto-merge engine with single reusable workflow #14 (merged by app/github-actions), the prior
iteration of this engine.
freshgate on validator dispatch prevents the re-dispatch loop:after finalization, the stamp is set but
freshis only true whenthe step actually performed
git push. Confirmed by static review.engine (on main), which will finalize, re-validate, and merge.
Change class
CI/workflow — four workflow files, two dispatcher templates, one
CHANGELOG entry.
Project-rulebook compliance
prose-collision, validator re-dispatch loop) all fixed.
pull_request, workflow_call, enablePullRequestAutoMerge).
Attribution
Assisted-by: pi ollama-cloud deepseek-v4-flash:preview (analysed on a live system)