fix(auto-merge): require same-repo head before enabling auto-merge#34
Conversation
Sync auto-merge.yml to the canonical template. The previous copy ran enable-auto-merge under pull_request_target and gated only on the head branch prefix (claude/, codex/, copilot/). The prefix is chosen by whoever opens the PR, and pull_request_target hands fork PRs the base repo's write token, so any outside contributor could fork, push a matching branch, and land it on main unreviewed. The "require a pull request" ruleset does not mitigate this: native auto-merge lands the change through a PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@coderabbitai autofix |
|
This command requires write access to the repository. Only users with write or admin permissions can trigger CodeRabbit to commit or create pull requests. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting 📝 WalkthroughWalkthroughThis PR modifies the auto-merge GitHub Actions workflow. Trigger events are restricted: pull_request_target now excludes the closed action, limited to opened, synchronize, reopened, and ready_for_review, and a new pull_request_review submitted trigger is added. The enable-auto-merge job condition is narrowed from a multi-prefix/approval-based policy to require a non-draft, same-repo PR with a head branch starting with claude/. A delete-merged-branch job is added/expanded to delete merged claude/ branch refs via the GitHub CLI on closed-and-merged same-repo PRs, tolerating already-deleted branches. Comment |
Syncs
auto-merge.ymlto the canonical template fromgithub-settings-automation.enable-auto-mergeran underpull_request_targetand gated only on the head branch prefix (claude/,codex/,copilot/). A branch prefix is chosen by whoever opens the PR, andpull_request_targetgrants fork PRs the base repo's write token — so any fork could push a matching branch and land it onmainunreviewed. The "require a pull request" ruleset does not mitigate this, since native auto-merge lands the change through a PR.This repo is consumed fleet-wide as a shared Renovate preset, so an unreviewed merge here propagates.
🤖 Generated with Claude Code