Skip to content

fix(auto-merge): verweigerten nativen Auto-Merge auffangen statt scheitern - #365

Merged
CybotTM merged 1 commit into
mainfrom
fix/auto-merge-workflows-permission
Aug 10, 2026
Merged

CybotTM merged 1 commit into
mainfrom
fix/auto-merge-workflows-permission

Conversation

@CybotTM

@CybotTM CybotTM commented Aug 9, 2026

Copy link
Copy Markdown
Member

Renovate-PRs, die eine GitHub-Action anheben, ändern eine Datei unter .github/workflows/. Für genau die verweigert GitHub den Aufruf enablePullRequestAutoMerge:

GraphQL: Pull request refusing to allow a GitHub App to create or update workflow
`.github/workflows/build.yml` without `workflows` permission (enablePullRequestAutoMerge)

Damit konnten solche PRs in jedem Repository mit required_status_checks nie landen — das ist der Zweig, der GitHub den Merge halten lässt. Aufgefallen an drei Renovate-PRs in phpmyadmin-docker-compose-stack, die seit gestern hängen.

Warum nicht einfach die Berechtigung ergänzen

Der Kopf dieser Datei sagt es selbst: eine hier deklarierte Berechtigung muss jeder Aufrufer ebenfalls gewähren, sonst scheitert der Lauf mit startup_failure, bevor irgendein Job startet. 76 Repositories rufen diesen Workflow auf, alle mit contents: write und pull-requests: write. Ein zusätzlicher Scope hier würde sie alle brechen, bevor er irgendetwas repariert.

Warum der Durchfall die richtige Behandlung ist

Der Gating-Pfad weiter unten wartet auf dieselben Checks und merged dann über REST — und die Beschränkung greift dort nicht. Belegt, nicht vermutet: in git-workflow-skill PR #153 hat genau dieser Pfad am 07.08.2026 eine Workflow-Datei gemerged, mit denselben Berechtigungen.

Zweite Änderung: ein verweigerter Merge ist eine Notiz, kein Fehlschlag

Die beiden anderen Nicht-Merge-Ausgänge melden bereits per ::notice:: und beenden mit 0. Der Merge-Befehl selbst tat das nicht. Ein roter Check ist aber genau das, was den PR auf UNSTABLE hält und jeden anderen Weg zum Merge zuschnürt — der Fehlschlag machte den PR also schwerer von Hand zu landen, als wenn dieser Workflow nie gelaufen wäre.

Geprüft

Mit einer gh-Attrappe über vier Fälle:

Fall Erwartung Ergebnis
nativer Aufruf verweigert, REST-Merge gelingt merged, exit 0 ✔
beide verweigert Notiz, exit 0 ✔
nativer Aufruf gelingt unverändert armed, exit 0 ✔
Repository ohne required checks unverändert gating ✔

Die Meldung „No required status checks…" erscheint jetzt nur noch auf dem Pfad, für den sie stimmt.

GitHub refuses enablePullRequestAutoMerge outright when the pull request
touches .github/workflows and the token carries no `workflows` scope:
"refusing to allow a GitHub App to create or update workflow ... without
`workflows` permission". Renovate bumping a GitHub Action hits this every
time, so on a repository with required status checks - the path that asks
GitHub to hold the merge - those pull requests could never land.

The scope cannot simply be added here. A permission this file declares
must also be granted by every caller, and one that has not been updated
yet startup-fails, so adding it would break the other callers before it
fixed anything.

Falling through to the gating path is not a workaround. That path waits
for the same checks itself and then merges over REST, which the
restriction does not cover - measured in netresearch/git-workflow-skill,
where PR #153 changed a workflow file and merged over exactly this path
with exactly these permissions.

A refused merge at the end of that path is now a notice rather than a
failure, matching how the two other non-merge outcomes already report.
Failing left a red check on the pull request, and a red check is what
holds it at UNSTABLE and shuts every other route to merging it - so the
failure made the pull request harder to land by hand than if this
workflow had never run.

Verified with a stubbed gh across four cases: native call refused then
REST merge succeeds, both refused, native call succeeds unchanged, and a
repository without required checks unchanged.

Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
Copilot AI lite review requested due to automatic review settings August 9, 2026 10:51
@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit 8230f8f into main Aug 10, 2026
12 of 13 checks passed
@CybotTM
CybotTM deleted the fix/auto-merge-workflows-permission branch August 10, 2026 07:14
@CybotTM CybotTM added the bug Something isn't working label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants