Skip to content

Register a merge queue target branch ​

Stamp's merge queue tests approved pull requests together and lands them on a branch in batches. On a Stamp where many teams' servers share Stamp's GitHub App, the queue lands only on a branch registered as its target. The Stamp operator registers some branches; a GitHub admin of the repository can register one on the repository's Settings → Merge queue page, in the Target branch box.

Registering may be off on your Stamp

Where registering a branch yourself isn't turned on, Register says "Registering a target branch yourself isn't turned on for this Stamp", and a branch registered for your server before stays registered but its queue doesn't run there: the box reads "Registered, not running". Ask the Stamp operator to register the branch for you. A Stamp that shows no Target branch box needs no registering.

Who can register ​

  • A person. Agents can't register or unregister a branch, and nobody can do it on your behalf.
  • Signed in to Stamp with GitHub connected, and named an admin of the repository by GitHub. Stamp asks GitHub with your own account each time you register or unregister; being an admin earlier does not count.
  • On a Stamp server whose GitHub App covers the repository.

What registering does ​

While the branch is registered, on every Stamp server:

  • The repository's merge queue belongs to your server. Only your server's people and agents set up and run a queue on it. On any other server the page says the queue belongs to another Stamp server (BATCH_REPOSITORY_OWNED), and agents' stamp queue setup, save, verify, enable and turn-off there are refused the same way. Nothing tells them which server.
  • Stamp refuses every direct push to the branch, from every server's agents, your own included (QUEUE_TARGET_REQUIRES_PR): changes reach it through pull requests.
  • Other servers can't merge into the branch (QUEUE_REQUIRED), whatever your queue's state, on or off. A server federated with yours can still join your queue while it's on.

A repository has one registered branch. All of this holds even where registering is turned off: turning it off only stops the queue from running on a branch that the registration alone names.

A branch the operator registers shows "Registered by the Stamp operator", with Register for this server: registering it yourself binds the repository's queue to your server as above.

Set up the queue, in this order ​

  1. Register. In Target branch, check the branch (it starts as the queue's saved branch, else the repository's default branch), choose Register, and confirm. The branch must already exist on GitHub: Stamp asks GitHub with your account, and refuses a branch GitHub doesn't have (QUEUE_TARGET_BRANCH_NOT_FOUND). The box then says who registered it for this server, and when.
  2. Save the settings. Pick the test workflow, choose Inspect checks, confirm the checks, and Save with queue off.
  3. Verify with a pull request someone else approved (an author's approval of their own pull request doesn't count), and wait for the result.
  4. On GitHub, let Stamp's GitHub App bypass "Require a pull request" on the branch, and nothing else. The queue lands each tested batch by pushing it with that App. Keep the required status checks and the rules against force pushes and deletion in force for it. In classic branch protection, add the App under "Allow specified actors to bypass required pull requests". With rulesets, a bypass covers every rule of its ruleset, so keep "Require a pull request before merging" in a ruleset of its own and add the App to that ruleset's bypass list only; don't add it to the rulesets with status checks, force-push or deletion rules. The step between Verify and Turn on on the page says the same.
  5. Turn on the queue.

Grant the bypass only once the branch is registered here, so that Stamp refuses direct pushes to it from the start.

Unregister ​

  1. Turn the queue off ("Turn off the merge queue"). Unregister is offered only while the queue is off; while it's on, paused or holding pull requests, unregistering is refused (QUEUE_TARGET_IN_USE). A queue saved again after it was on counts as on until you turn it off; one that was never on needs no turning off once its verification has ended.
  2. On GitHub, remove Stamp's GitHub App from the branch's bypass lists: its branch protection, and every ruleset with a pull request rule for the branch.
  3. Unregister, and confirm.

Stamp then reads, with your GitHub account, whether its App can still bypass the branch's pull request rule: the bypass list of the branch protection, and that of each ruleset with a pull request rule for the branch.

  • A list still names Stamp's App: refused (QUEUE_TARGET_BYPASS_GRANTED), nothing changed. Remove it on GitHub and unregister again.
  • Stamp couldn't read a list: GitHub refused or failed the read, or didn't show the list. GitHub shows the bypass list of an organization's or enterprise's ruleset only to someone who may change that ruleset, so an empty list there counts as unread. The dialog asks you to check on GitHub that Stamp's App can't bypass "Require a pull request" there; for a ruleset whose list you can't see, ask an owner of the organization (or enterprise) to check it, and to remove the App if it's listed. Once that's done, tick "I removed Stamp's App from the bypass list" and Unregister: your confirmation is recorded in place of Stamp's read. Confirm only what you checked: once the branch is unregistered, Stamp no longer refuses direct pushes to it, so Stamp's App must not be able to bypass the rule.
  • GitHub's rate limit refused a read (GITHUB_RATE_LIMITED): try again later. A confirmation doesn't stand in for it.
  • No list names it: the branch is unregistered.

Once unregistered, Stamp stops refusing direct pushes to the branch on every server, unless the operator registers it.

If nobody can unregister the branch (the server it's registered to can't act on the repository any more, or nobody can check a bypass list Stamp can't read), ask the Stamp operator: they can remove the registration. Moving a registration to another server isn't on the page. Removing it doesn't move the repository's queue either: a queue the registered server set up stays that server's, and the page can't take it over. If that server is gone (Stamp was removed from it, or it was deleted), the operator can also release its queue: it's turned off, and the first server to set up a queue for the repository, or register the branch, takes it. If that queue is on, have it turned off first: once the registration is gone it can't land anything, but it still keeps pull requests from merging into the branch directly.

Refusals you may meet ​

CodeWhenWhat to do
QUEUE_REGISTRATION_OFFRegister, where registering is turned off on this StampAsk the Stamp operator to register the branch
QUEUE_REGISTRATION_UNAVAILABLERegister, on a Stamp where branches need no registeringNothing to do
BATCH_SELF_SERVICE_UNAVAILABLESetting up a queue yourself is off on this StampAsk the Stamp operator
BATCH_PLATFORM_UNAVAILABLEThe merge queue isn't ready on this StampAsk the Stamp operator; trying again later is safe
BATCH_ADMIN_REQUIREDGitHub doesn't name you an admin of the repositoryAsk a repository admin
BATCH_BRANCH_INVALIDRegister: not a branch the queue may land on (a malformed name, or one Stamp reserves, such as stamp-mq/… or stamp-ci/…)Check the name and try again
QUEUE_TARGET_BRANCH_NOT_FOUNDRegister: GitHub has no branch of that name in the repositoryCheck the name, or create the branch on GitHub first
BATCH_REPOSITORY_OWNEDThe repository's queue, or its registration, is another Stamp server'sA person on that server manages it
QUEUE_REGISTRATION_EXISTSRegister: the repository already has a registered branchUnregister it first
QUEUE_REGISTRATION_MISSINGUnregister: nothing is registered for this serverNothing to do
QUEUE_TARGET_IN_USEUnregister: the queue on the branch is on, paused or holding pull requestsTurn the queue off first
QUEUE_TARGET_BYPASS_GRANTEDUnregister: Stamp's App may still bypass the branch's pull request ruleRemove the App from the bypass list on GitHub, then unregister
QUEUE_TARGET_BYPASS_UNKNOWNUnregister: Stamp couldn't read every bypass listCheck on GitHub, then confirm (above)
QUEUE_REGISTRATION_CHANGEDUnregister: the registration changed since you read the pageRead the page again
GITHUB_RATE_LIMITEDGitHub's rate limit refused a readTry again later
QUEUE_BUSY, BATCH_STORE_UNAVAILABLEThe queue was finishing a step, or Stamp couldn't read its recordsNothing changed; try again in a moment
BATCH_TARGET_NOT_CONFIGUREDVerify, on a branch this server's queue may not run onRegister the branch above, or ask the Stamp operator

Your agents meet QUEUE_TARGET_REQUIRES_PR when they push to a registered branch. Their stamp queue commands on a branch that isn't a target for your server are refused QUEUE_TARGET_NOT_REGISTERED; where registering is turned on, its next step names the repository's Settings → Merge queue page.