feat(auto-merge): reusable workflow with App token - #5
Merged
Conversation
…N cascade-block) Splits auto-merge.yml into: - auto-merge-reusable.yml: workflow_call entrypoint, all 5 tiers, uses actions/create-github-app-token@v2 to mint an installation token. Required secrets: AUTOMERGE_APP_ID, AUTOMERGE_APP_PRIVATE_KEY. - auto-merge.yml: thin caller for this repo's own auto-merge, delegates to the reusable workflow via secrets: inherit. Why: when auto-merge fires under GITHUB_TOKEN identity, the resulting push: main event is silently filtered by GitHub's anti-loop protection, so downstream publish workflows never run. Using a GitHub App installation token makes the App the merge actor — push events fire normally and downstream workflows trigger. Symptom this fixes: PRs auto-merged by the Owner tier on ANcpLua.NET.Sdk landed on main but never triggered the publish workflow (e.g. PR #99 2026-05-04, manually dispatched via workflow_dispatch). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting Summary by CodeRabbit
WalkthroughThis PR extracts auto-merge logic into a reusable GitHub Actions workflow and refactors the main workflow to delegate to it. The reusable workflow defines five job types—Dependabot, Renovate, AI agents, CodeRabbit, and owner PRs—using a GitHub App token instead of GITHUB_TOKEN to bypass anti-loop filtering. ChangesGitHub Actions Auto-Merge Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Comment |
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the auto-merge workflow into a reusable workflow. Single source of truth for the framework's auto-merge tiers — fixes the GITHUB_TOKEN cascade-block bug that silently prevents downstream publish workflows from triggering after auto-merge.
Changes
The bug this fixes
When the Owner / AI Agent / CodeRabbit tier calls `gh pr merge --auto` under `GITHUB_TOKEN` identity, GitHub records the eventual native-auto-merge as performed by `github-actions[bot]`. Per GitHub docs, events triggered by `GITHUB_TOKEN` (other than `workflow_dispatch` / `repository_dispatch`) do NOT trigger new workflow runs — anti-loop protection. So the resulting `push: main` is silently dropped and the publish workflow never runs.
Symptom seen on 2026-05-04: ANcpLua.NET.Sdk PR #99 (chore/naming-runtime-aligned-2026) merged via Owner tier at 20:22:30 UTC. `push: main` for the merge commit `3894a06` produced ZERO workflow runs. SDK had to be manually dispatched via `gh workflow run` to ship v3.4.16.
Renovate / Dependabot tier merges aren't affected because those bots merge with their own bot tokens (visible in PR #100 `merged_by: renovate[bot]`), which DO trigger downstream workflows.
The fix: use a GitHub App installation token. The App becomes the merge actor; events fire normally.
Required follow-up
Each consumer repo (ANcpLua.NET.Sdk, .Roslyn.Utilities, .Analyzers, .Agents, qyl) needs a thin caller workflow + the two secrets. PRs for those will follow this one.
One-time GitHub App creation is the only manual step:
Test plan