ci(auto-merge): drop App-based reusable workflow, use native auto-merge#149
Conversation
The AUTOMERGE_APP_ID GitHub App was deleted on 2026-05-12 as an antipattern (single point of failure across 4 repos, maintenance overhead, and Renovate's platformAutomerge already handles the bot tier natively without it). This replaces the thin caller into ANcpLua/renovate-config's auto-merge-reusable.yml with an inline workflow that uses GITHUB_TOKEN's pull-request:write scope to call `gh pr merge --auto --squash`. Branch protection still gates the merge on required status checks. Tiers retained: Owner PRs, AI Agent PRs (claude/, copilot/, jules/), CodeRabbit-approved PRs. Renovate bot tier is handled entirely by the shared preset's platformAutomerge:true + automerge:true rules, so no workflow tier is needed for it. Dependabot tier dropped — not used in any ANcpLua framework repo. Prereq verified: repo Settings → "Allow auto-merge" is enabled on all four repos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe workflow file was updated to replace the reusable workflow delegation with direct GitHub native auto-merge implementation. The previous job that called the external reusable workflow was removed. A new Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (6 passed)
Comment |
|
@coderabbitai autofix |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
There was a problem hiding this comment.
Pull request overview
This PR replaces the repo’s previous App-based, reusable auto-merge workflow with an inline GitHub Actions workflow that enables native GitHub auto-merge using gh pr merge --auto --squash and the built-in GITHUB_TOKEN.
Changes:
- Removed the reusable workflow invocation (and related App/secret assumptions) in favor of an inline job.
- Added logic to enable native auto-merge for certain PR “tiers” (AI-agent branch prefixes, “owner” PRs, and CodeRabbit approvals).
- Updated workflow documentation/comments to reflect the new auto-merge approach and prerequisites.
| startsWith(github.event.pull_request.head.ref, 'claude/') || | ||
| startsWith(github.event.pull_request.head.ref, 'copilot/') || | ||
| startsWith(github.event.pull_request.head.ref, 'jules/') || |
| startsWith(github.event.pull_request.head.ref, 'claude/') || | ||
| startsWith(github.event.pull_request.head.ref, 'copilot/') || | ||
| startsWith(github.event.pull_request.head.ref, 'jules/') || | ||
| github.event.pull_request.user.login == github.repository_owner || |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f6b507058
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| startsWith(github.event.pull_request.head.ref, 'claude/') || | ||
| startsWith(github.event.pull_request.head.ref, 'copilot/') || | ||
| startsWith(github.event.pull_request.head.ref, 'jules/') || |
There was a problem hiding this comment.
Restrict agent-branch auto-merge to trusted authors
The claude/, copilot/, and jules/ checks rely only on pull_request.head.ref, which is attacker-controlled for fork PRs; any external contributor can open a fork branch with one of these prefixes and this job will call gh pr merge --auto --squash on their PR. In this repository’s stated branch-protection model (0 required approvals), that effectively bypasses human review and can auto-merge untrusted changes once CI passes. Add an author/repo-origin trust check (for example, verify head.repo.full_name == github.repository and/or an allowlist of actor logins) before enabling auto-merge.
Useful? React with 👍 / 👎.
| startsWith(github.event.pull_request.head.ref, 'claude/') || | ||
| startsWith(github.event.pull_request.head.ref, 'copilot/') || | ||
| startsWith(github.event.pull_request.head.ref, 'jules/') || | ||
| github.event.pull_request.user.login == github.repository_owner || |
There was a problem hiding this comment.
Use a real maintainer predicate for owner PRs
github.event.pull_request.user.login == github.repository_owner does not match maintainer-authored PRs when the repository owner is an organization (as in ANcpLua/ANcpLua.NET.Sdk), so the documented “Owner PRs” path never triggers unless the branch also matches an AI-agent prefix. This regresses the intended auto-merge behavior for human maintainers; switch to a maintainer/member permission check rather than comparing author login to repository owner.
Useful? React with 👍 / 👎.
Summary
Replaces the App-based reusable auto-merge workflow with an inline
gh pr merge --auto --squashworkflow. No GitHub App, noAUTOMERGE_*secrets, no reusable workflow dependency.Why
The
AUTOMERGE_APP_IDGitHub App was deleted on 2026-05-12 as anantipattern:
platformAutomerge: true(default) already handles thebot tier natively via the shared
github>ANcpLua/renovate-configpreset — no App needed for it
cross-author-approval value-add is moot
nuget-publish.ymlis gated onpush: tags v*(manual tag), not onpush: main, so aGITHUB_TOKEN-driven merge does not break thepublish chain
What changed
.github/workflows/auto-merge.yml: removeduses: ANcpLua/renovate-config/.../auto-merge-reusable.yml@<sha>+secrets: inherit; replaced with an inline job that runsgh pr merge --auto --squashfor Owner / AI-agent / CodeRabbit-approved PRs.Test plan
gh api repos/.../allow_auto_merge→true)AUTOMERGE_APP_IDandAUTOMERGE_APP_PRIVATE_KEYsecretsalready deleted from this repo (
gh secret listshows none)either runs (and enables native auto-merge on this very PR) or
skips cleanly
get auto-merge enabled at PR-open without manual
gh pr merge --auto🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit