Skip to content

🏗️✨:land a pull request when it is labelled - #1815

Merged
DerekNonGeneric merged 1 commit into
livefrom
feat/commit-queue
Aug 15, 2026
Merged

🏗️✨:land a pull request when it is labelled#1815
DerekNonGeneric merged 1 commit into
livefrom
feat/commit-queue

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

Phase 3. Applying commit-queue to a pull request hands it to the same task that has been landing them by hand, running as the app rather than as anyone in particular.

The four decisions, as built

decision how it shows up here
Per-repo subject style The lander names no repository and no branch: GITHUB_REPOSITORY in a workflow, the git remote in a terminal, and the default branch asked of the API. A vendored copy needs one import line changed and nothing else.
A GitHub App actions/create-github-app-token mints a token per run from LAND_APP_ID and LAND_APP_PRIVATE_KEY.
Copy the files Everything shareable is two files — build/shared/landing.mts and the task — and neither knows where it is.
Green checks, labeller has write Both are refusal reasons alongside the existing ones.

The two new guards

Every check must have finished and passed. Anything still running counts against it: a label applied while a check was in flight says nothing about how that check turned out. Neutral and skipped do not count against it, since neither is a complaint. Both kinds are read — several services on this repository report the older commit statuses rather than check runs, and looking only at check runs would call a red commit green.

Whoever applied the label must have the right to push. On GitHub, triage permission can apply labels but cannot push, so without this the label would quietly hand out an access level GitHub had withheld. Run from a terminal instead of a workflow, the check falls back to whoever owns the token, so there is no path where it is silently skipped.

Seven tests on the verdict logic, which is pure and lives in landing.mts; only the fetching is in the task.

On pull_request_target

It is used because pull_request gives a fork a read-only token and no secrets, and #1274 came from a fork. It is only safe because nothing here checks out or executes the branch's code: the checkout is the base branch, and the branch under review is fetched solely so its commit messages can be read. The workflow says so at the top, and says not to add a build, install or test step — those belong in the checks it waits for, which run without a token that can write anything.

Verification

  • nps test — 16/16 tasks, 63/63 tests
  • The commit-queue label now exists
  • The lander still refuses correctly by hand: a closed pull request, a non-numeric argument, no argument

Important

This one has to land the old way. pull_request_target takes the workflow from the base branch, so a workflow added by a pull request cannot run on that same pull request. Once it is on live, the next pull request is the first real test — and the thing to watch is whether the merge triggers deploy.yml, since a merge that does not is the whole reason we are not using GITHUB_TOKEN.

The commit queue. Applying `commit-queue` to a pull request hands it to
the same task that has been landing them by hand, running as a GitHub
app rather than as anyone in particular.

Two things are checked before anything merges, beyond what landing by
hand already checked. Every check has to have finished and passed, since
a label applied while one was in flight says nothing about how it turned
out. And whoever applied the label has to have the right to push:
labelling needs only triage, so without this the label would quietly
hand out an access level GitHub had withheld.

Nothing here checks out or runs the branch's code. `pull_request_target`
reaches secrets, which is why it is used, and that is only safe while
the code being read belongs to the base branch.

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 770f08b
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a7fdb2cd4586c0008b416f4
😎 Deploy Preview https://deploy-preview-1815--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 merged commit c526238 into live Aug 15, 2026
14 checks passed
DerekNonGeneric added a commit that referenced this pull request Aug 15, 2026
🏗️🔧:survive a failed call to the GitHub API

Landing #1815 crashed once with a stack trace and worked on a second
run, unchanged, which is what a transient 502 or a throttled request
looks like from here. Reads are now tried twice; a merge is not, since
repeating one that already reached GitHub would report the pull request
as unmergeable when it had in fact just merged.

Anything still unexpected reports a line rather than a stack trace. That
needed the repository, the default branch and the actor to be worked out
when first wanted instead of as the file loads, since nothing could
catch them failing up there.

🏗️🔧:stop the queue waiting for itself

The queue reports as a check like any other job, so requiring every
check to have finished meant requiring itself to have finished, which it
cannot do until it stops waiting. Labelling #1816 deadlocked on exactly
that, which is what an end-to-end test is for.

Its own run is identified by the run id in the check's details URL
rather than by the job's name, so renaming the job cannot quietly
reintroduce the deadlock. Every other run still counts, including
another queue run on the same commit.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
PR-URL: #1816
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