Skip to content

🏗️🔧:ask REST to take the label back off - #1819

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/remove-the-label-over-rest
Aug 15, 2026
Merged

🏗️🔧:ask REST to take the label back off#1819
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/remove-the-label-over-rest

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

Prompted by your question about whether the queue would strip a pull request's other labels. It would not — but answering it turned up something worth fixing.

The answer, from a real run

Adding three labels to a merged pull request accidentally triggered a genuine queue run, which refused and took its label off:

before:  [commit-queue, dependencies, javascript]
after:   [dependencies, javascript]

--remove-label is subtractive, not a replace. Renovate's pull requests, which arrive carrying three labels each, are safe.

That run also showed the if: github.event.label.name == 'commit-queue' guard doing its job: three labels emitted three labeled events, and the queue skipped the two that were not its own.

What it turned up

gh pr edit and gh pr comment reach for GraphQL, which wants organization permissions that removing a label and posting a comment do not need. The app satisfies them today, so this works. But tightening its permissions, or installing it on a repo where it has fewer, would break both silently — one hides behind || true, and the other only ever runs when something has already gone wrong.

The REST endpoints need only the pull request permission the app already has. The label one also names a single label in the path, rather than trusting a flag to behave subtractively.

Verified from my own terminal, whose token deliberately lacks read:org:

gh pr edit --remove-label fails: the 'login' field requires ['read:org']
gh api -X DELETE …/labels/build on a PR labelled build, security succeeds, leaves [security]
the same DELETE for a label that is not there exits non-zero, which is what the `

Verification

`gh pr edit` and `gh pr comment` reach for GraphQL, which wants
organization permissions that removing a label and leaving a comment do
not need. The app satisfies them today, so this works; tightening its
permissions or installing it somewhere with fewer would break both
silently, since one hides behind a `|| true` and the other only runs
when something has already gone wrong.

The REST endpoints need only the pull request permission the app already
has, and the label one names a single label in the path rather than
trusting a flag to be subtractive. Checked both ways: removing one label
from a pull request carrying two leaves the other alone, and removing a
label that is not there exits non-zero, which is what the `|| true` is
for.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit cb83c56
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a7febc584aaf400082a9257
😎 Deploy Preview https://deploy-preview-1819--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@DerekNonGeneric DerekNonGeneric added the commit-queue Land this pull request when its checks pass label Aug 15, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit a4ecde8 into live Aug 15, 2026
15 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the commit-queue Land this pull request when its checks pass label Aug 15, 2026
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