Repository navigation
fix(ci): replace per-repo inline auto-merge engine with single reusable workflow - #14
Conversation
…reusable workflow BREAKING CHANGE: every opencharly repo must install the new dispatcher at .github/workflows/auto-merge.yml (org-wide-auto-merge-dispatcher.yml). The org-wide auto-merge engine now lives in ONE reusable workflow (.github/workflows/auto-merge-reusable.yml, workflow_call) and is called by a ~20-line dispatcher in each target repo. Changes: - .github/workflows/auto-merge-reusable.yml — THE canonical engine - .github/workflows/auto-merge.yml — dispatcher for .github repo itself - org-wide-auto-merge-dispatcher.yml — template for other repos - .github/workflows/pr-validator.yml — added workflow_call support - .github/scripts/auto-merge-*.sh — deleted (no more de-templated copy) Engine improvements: - Octokit for all API calls (no raw gh api, no fragile bash grep) - GraphQL enablePullRequestAutoMerge mutation for native auto-merge - createWorkflowDispatch for validator re-trigger (no re-run dance) - Finalization note inserted BEFORE ## Attribution (preserves footer) - All checks-waiting delegated to GitHub native auto-merge
Review — BLOCKHead SHA: Change class: CI/workflow — replaces the per-repo inline auto-merge engine with a single reusable Security screen: PASS — no new secrets, no exfiltration, no scope mismatch, no weakened credential handling. The engine's reliance on native auto-merge (which waits for required checks) instead of the old Blocks
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — BLOCKHead SHA: Change class: CI/workflow — replaces the per-repo inline auto-merge engine with a single reusable Security screen: PASS — no new secrets, no exfiltration, no scope mismatch, no weakened credential handling. GITHUB_TOKEN is passed via Blocks
Dispositions of prior comments
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
The validator caught that Steps 8 (Enable auto-merge) and 9 (Wait for merge and tag) ran unconditionally. For an already-merged PR that arrives via workflow_run, Step 2 handles the tag and the engine should stop — not attempt auto-merge on a closed PR with no node_id/number set.
Review — BLOCKHead SHA: Change class: CI/workflow — replaces the per-repo inline auto-merge engine with a single reusable Security screen: PASS — no new secrets, no exfiltration, no scope mismatch, no weakened credential handling. GITHUB_TOKEN via Blocks
Dispositions of prior comments
Verdict: BLOCK openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
…is the dispatcher now)
Review — PASSHead SHA: Security screen: PASS — no new secrets, no exfiltration, no scope mismatch, no weakened guardrails. Checklist: All applicable rules PASS or NA.
Prior reviewer findings all resolved in the current head: B19/A1 (CHANGELOG added, body corrected), R10 misclassification (corrected), B16 Step 8 guard (added), R5 stale comment (fixed). Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no new secrets, no exfiltration, no scope mismatch, no weakened credential handling. Checklist: All applicable rules PASS or NA.
Prior reviewer findings all resolved in the current head: B19/A1 (CHANGELOG added, body corrected), R10 misclassification (corrected), B16 Step 8 guard (added), R5 stale comment (fixed). Verdict: PASS openrouter/deepseek/deepseek-v4-flash-0731 — pi-review-action. |
fix(ci): replace the per-repo inline auto-merge engine with a single reusable workflow
The change
The org-wide auto-merge engine previously existed as a 353-line inline
run:blockin
.github/workflows/auto-merge.yml, copy-pasted identically into all 14 opencharlyrepos. This PR replaces that pattern with a single reusable workflow
(
.github/workflows/auto-merge-reusable.yml,workflow_call) called by a ~20-linedispatcher in each target repo.
The engine itself is rewritten to use proper GitHub Action mechanisms:
actions/github-script@v7(Octokit) for ALL GitHub API interactions — findingthe PR, checking state, updating the body, listing check-runs, creating tags.
No raw
gh apicalls, no fragile JSON-grep pipelines.github.graphql(GraphQL mutationenablePullRequestAutoMerge) to enablenative auto-merge instead of the gh CLI
--autoflag.actions.createWorkflowDispatchto trigger the validator on the finalizedhead, replacing the fragile "find the action_required run and re-run it" dance.
polls check-runs in bash; GitHub's native auto-merge waits for every required status check.
Bugs fixed in the engine:
## Attributionsection, so theAssisted-by:attribution footer remainsthe last line in the PR body (A1 compliance).
stamp (prose cannot collide with it).
New file structure:
.github/workflows/auto-merge-reusable.yml.github/workflows/auto-merge.ymlorg-wide-auto-merge-dispatcher.yml.github/workflows/pr-validator.ymlworkflow_call(for the same dispatcher pattern)Deleted:
.github/scripts/auto-merge-harness.sh,.github/scripts/auto-merge-runblock.sh— no longer needed; the engine has no de-templated copy.
Change class
CI/workflow — workflow definitions (
auto-merge-reusable.yml,auto-merge.yml,pr-validator.yml), the dispatcher template, and one CHANGELOG entry. No code,no candies, no runtime packaging.
How tested
v<YYYY.DDD.HHMM>; SDK:v0.<YYYYDDD>.<HHMM stripped>).main)processes this PR through the existing auto-merge workflow. Once merged, all future
PRs use the new reusable engine.
if: steps.pr.outputs.state == 'open'on every subsequent step, so a mergedPR that arrives via the
workflow_runtrigger is safely tagged without attemptingauto-merge.
Project-rulebook compliance
root-caused in the engine rewrite; the new engine removes the fragile re-run
dance entirely by using native auto-merge. The gate for this change-class
(CI/workflow) is the engine's own landing through the existing auto-merge.
pr-validator, clean up old scripts.
native auto-merge) instead of bash polling.
.github/scripts/auto-merge-*.shdeleted; no stale references.squash-merges.
Attribution
Assisted-by: pi ollama-cloud deepseek-v4-flash:preview (analysed on a live system)
Auto-merge finalization
This run finalized the CHANGELOG at merge time: the placeholder was
renamed to
CHANGELOG/2026.233.0511.md(H1 rewritten to# 2026.233.0511). The current diffcarries the finalized file.