fix(ci): restore contents scope and narrow disable-automerge - #583
Conversation
Removing the `|| true` in #566 revealed that this job fails with FORBIDDEN ("Resource not accessible by integration"). It had been failing silently, so the safety net it provides has never actually worked. Two changes. Grant `contents: write` back: the job lost it when workflow-level permissions were scoped per job, and `pull-requests: write` alone is not enough for disablePullRequestAutoMerge. And stop firing on PRs into main — those are release promotions onto a protected branch, so there is nothing unsafe to undo. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe disable-automerge job now has ChangesAutomerge workflow controls
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🔵 Low · up to The workflow restores the requested write access and narrows the safeguard to relevant branches, but repository or pull-request-specific token policies may still prevent it from cancelling unsafe queued merges. The PR is mergeable with explicit owner follow-up to verify affected fork and Dependabot cases and adjust authorization if needed. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
New evidence that weakens this PR's stated hypothesis. Read before merging. The v0.17.0 release run surfaced a second permission failure, in a different job: And the settings confirm it, at both repo and org level: So The scope narrowing in this PR (not firing on promotions into The larger finding: That is a settings change and Tomás's call, so I have not touched it. |
…585) ## Context I enabled **Allow GitHub Actions to create and approve pull requests** at the org and repo level, which unblocked `sync-develop` — it had been failing with `GitHub Actions is not permitted to create or approve pull requests` since forever. Re-running it against the v0.17.0 build now succeeds. But it immediately produced #584, which **cannot merge**. ## The problem `sync-develop` opened a `develop ← main` PR. That shape deadlocks: `develop` requires the head branch to be up to date, and `main` falls behind `develop` the moment anything lands after the release — #582 and #583 did exactly that. #584 has been sitting at `BEHIND` since it was created. I hit the same wall by hand earlier tonight with #577. Even if it could merge, the squash auto-merge would replay the content as a fresh commit and **not** establish ancestry, which is the entire point of a back-merge. That is what went wrong in #578 and #579. ## The fix Push a branch descended from `develop` with `main` merged into it, then open that against `develop`. Same thing that finally worked manually in #581. - Named `chore/backmerge-main-<tag>`, which matches the exclusion added in #580 so `automerge.yml` leaves it alone. - The job arms auto-merge itself with `--merge`, so it lands as a merge commit. - Exits early when `main` is already an ancestor, or when the branch already exists, so re-runs are safe. ## Follow-up #584 should be closed — this replaces it. The next release will exercise this path for real. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 0.18.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What removing
|| truerevealedThe
disable-automergejob fails with:It had been failing silently behind
|| true(see run 32602609796 on #571). The safety net that is supposed to stop a queued auto-merge from landing on an unprotected base has never actually worked — it just reported green.Honest note on cause
I cannot prove this was pre-existing. The job lost
contents: writeearlier in #566 when I scoped workflow-level permissions per job on a least-privilege review, and|| truemeant no run before or after ever surfaced a failure. Two live hypotheses:contents: writeand the least-privilege narrowing broke it.This PR tests hypothesis 1 by granting the scope back. If FORBIDDEN returns with both scopes present, the cause is a repository or org restriction on
GITHUB_TOKENand needs a settings change or a PAT — the comment in the file says so, so the next person does not have to rediscover it.Scope narrowing
The job fired on every PR whose base was not
develop, which includes release promotions intomain.mainis protected; there is no unsafe queued merge to undo there. The risk this job exists for is landing on an unprotected base, so it now fires only on drafts, or on a base that is neitherdevelopnormain.Not changed
The loud failure stays. Going back to
|| truewould restore exactly the false confidence that hid this.🤖 Generated with Claude Code
Summary by CodeRabbit
mainanddevelopfrom automatic processing.