ci: auto-enable merge-when-ready on every PR open - #240
Conversation
No human or agent needs to remember gh pr merge --auto anymore -- this flips every non-draft PR into GitHub's native auto-merge state the moment it's opened. Branch protection's required status checks still gate the actual merge; GitHub re-syncs a BEHIND branch itself. Configurable without a code change: gh variable set AUTO_MERGE_ENABLED --body false to disable repo-wide.
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow that automatically enables squash auto-merge for eligible non-draft pull requests unless disabled by the ChangesAutomatic pull request merging
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant PullRequest
participant GitHubActions
participant GitHubMergeAPI
PullRequest->>GitHubActions: Open, reopen, or mark ready for review
GitHubActions->>GitHubActions: Check repository setting and draft status
GitHubActions->>GitHubMergeAPI: Request squash auto-merge
GitHubMergeAPI->>PullRequest: Merge after required checks and delete branch
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
enablePullRequestAutoMerge rejects the Actions-issued token with 'Resource not accessible by integration' regardless of declared permissions. Needs a real PAT in the AUTOMERGE_TOKEN secret.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/auto-merge.yml (1)
10-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider adding a
concurrencygroup to cancel duplicate runs.If multiple trigger events fire for the same PR in quick succession (e.g., opened then ready_for_review), duplicate workflow runs could overlap. A
concurrencygroup keyed on the PR number would cancel superseded runs and reduce noise.♻️ Optional: add concurrency group
jobs: enable-auto-merge: name: Enable auto-merge + concurrency: + group: auto-merge-${{ github.event.pull_request.number }} + cancel-in-progress: true # Toggle repo-wide without touching this file:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/auto-merge.yml around lines 10 - 17, Add a workflow-level or job-level concurrency configuration for enable-auto-merge, using the pull request number as the group key and enabling cancellation of in-progress runs. Keep the existing auto-merge condition and runner configuration unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/auto-merge.yml:
- Around line 10-17: Add a workflow-level or job-level concurrency configuration
for enable-auto-merge, using the pull request number as the group key and
enabling cancellation of in-progress runs. Keep the existing auto-merge
condition and runner configuration unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d626d14-0371-47af-a1e5-3efbe3e49dda
📒 Files selected for processing (1)
.github/workflows/auto-merge.yml
External contributions never get auto-merge auto-enabled here regardless of CI status -- head.repo.full_name != repository is an explicit gate, not an accident of GitHub blocking secrets from fork-triggered pull_request runs.
Summary
.github/workflows/auto-merge.yml: on every non-draft PR'sopened/reopened/ready_for_reviewevent, callsgh pr merge --auto --squash --delete-branchon it — flips the PR into GitHub's native auto-merge staterequired_status_checks.strict=truemeans every PR goes BEHIND whenever a sibling merges first, and a human/agent has to remember to pass--auto(or manually rebase) to unstick it. This makes that automatic — no one has to remember anythinggh variable set AUTO_MERGE_ENABLED --body falsedisables it repo-wide; unset ortrue(default) keeps it onpull_requesttrigger (notpull_request_target) — no checkout, no need for elevated fork-PR permissions, avoids the zizmorpull_request_target-is-almost-always-insecure flag hit on ci: add PR title Conventional Commits check #238 earlier this sessionTest plan
pull-requests: writepermission only, matching this repo's per-job permissions conventionSummary by CodeRabbit