Skip to content

fix(ci): grant the sweep the workflows scope it needs to merge CI changes - #287

Merged
github-actions[bot] merged 1 commit into
mainfrom
ci/grant-workflows-scope
Aug 7, 2026
Merged

fix(ci): grant the sweep the workflows scope it needs to merge CI changes#287
github-actions[bot] merged 1 commit into
mainfrom
ci/grant-workflows-scope

Conversation

@catomean

@catomean catomean commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

What this fixes

The auto-merge sweep cannot merge any PR that edits .github/workflows/.

Merging such a PR writes workflow files to the base branch, and GitHub gates
that on the workflows permission — which auto-merge.yml never granted. The
symptom is indirect and misleading: GITHUB_TOKEN is told the PR is

MERGEABLE/BLOCKED

while a PAT reads the same PR at the same moment as MERGEABLE/**CLEAN**,
because mergeStateStatus is computed per viewer.

Every merge path is refused identically — gh pr merge, gh pr merge --auto
(#283), and PUT /pulls/{n}/merge (#286). Ruled out along the way:

checked result
branch protection on main exists, every option disabled
rulesets / CODEOWNERS / required checks / required reviews none
"the bot can't write workflows at all" false — #224/#225/#226 modify workflows and merged

Blast radius

#278 and #282 have been green and unmergeable through eight sweeps. Both fix
CI itself, so both are in exactly the class this blocks.

⚠️ This PR cannot merge itself

It is the change that grants the permission, so it needs one merge by
hand
. After that the queue is self-draining again — including #278 and #282.

🤖 Generated with Claude Code

…nges

Merging a PR that edits .github/workflows/ writes those files to the base
branch, and GitHub gates that on the `workflows` permission. The sweep never
had it, so such a PR is reported to GITHUB_TOKEN as MERGEABLE/BLOCKED — while
a PAT reads the identical PR as MERGEABLE/CLEAN, because mergeStateStatus is
computed per viewer.

Every merge path is refused identically: `gh pr merge`, `gh pr merge --auto`,
and PUT /pulls/{n}/merge. That is what stranded #278 and #282 through eight
sweeps while PRs touching nothing under .github/ merged normally throughout.

Note this PR cannot merge itself — it is the very change it enables, so it
needs one merge by hand. Everything after it is self-merging again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions
github-actions Bot merged commit 9e76820 into main Aug 7, 2026
8 checks passed
@github-actions
github-actions Bot deleted the ci/grant-workflows-scope branch August 7, 2026 14:09
catomean added a commit that referenced this pull request Aug 7, 2026
…eep (#288)

`workflows: write` is not a valid GITHUB_TOKEN permissions key. GitHub
refuses to parse the file at all — "Unexpected value 'workflows'" — which
silently disabled every trigger: no cron sweep, no workflow_run sweep, no
dispatch. Auto-merge was dead from the moment #287 landed (14:08Z) until now.

The underlying truth #287 was reaching for: GITHUB_TOKEN has NO scope that
permits writing workflow files, so a PR that edits .github/workflows/ can
never be merged by the sweep — it reads as MERGEABLE/BLOCKED to the bot and
every merge path refuses. That is a platform limit, not a config gap. Such
PRs take one `gh pr merge --squash` with a personal token; everything else
self-merges. Documented at the permissions block.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant