View as Markdown

Mergify Dequeue Command

Remove a pull request from a merge queue.


The dequeue command removes a pull request from the merge queue. This command is ideal for situations where you realize a pull request either shouldn’t be merged or needs further revision before merging.

@Mergifyio dequeue

A queue command leaves a pull request in one of two states, and dequeue covers both:

  • In the queue. Mergify takes the pull request out and reports that it has been removed from the queue.

  • Waiting to enter it. A queue command stays pending until the pull request matches a queue’s queue_conditions. dequeue cancels that pending command, so the pull request is not queued later when the conditions eventually match.

When neither applies, Mergify answers that the pull request is not queued and does nothing else.

When a pull request is dequeued while being tested, the pull requests tested with it or behind it are tested again:

Tests PR2 dequeued PR1 PR1: ahead of PR2, its test carries on, and passes. passes PR1 + PR2 PR1 + PR2: cancelled when PR2 is dequeued. cancelled PR1 + PR2 + PR3 PR1 + PR2 + PR3: cancelled when PR2 is dequeued. cancelled PR1 + PR3 PR1 + PR3: PR3 tested again, without PR2, and passes. passes Pull requests PR1 merged PR2 PR2 leaves the queue when the dequeue command runs. PR2 leaves the queue when the dequeue command runs. dequeued PR3 merged Tests PR2 dequeued PR1 PR1: ahead of PR2, its test carries on, and passes. passes PR1 + PR2 PR1 + PR2: cancelled when PR2 is dequeued. cancelled PR1 + PR2 + PR3 PR1 + PR2 + PR3: cancelled when PR2 is dequeued. cancelled PR1 + PR3 PR1 + PR3: PR3 tested again, without PR2, and passes. passes Pull requests PR1 merged PR2 PR2 leaves the queue when the dequeue command runs. PR2 leaves the queue when the dequeue command runs. dequeued PR3 merged
Dequeuing a pull request cancels the test that holds it and every test behind it. The pull requests in them stay in the queue and are tested again without it, while the tests ahead carry on. Green passed, dashed was cancelled. Not to scale.

A dequeued pull request never rejoins the queue on its own. Run @mergifyio queue again once it’s ready, as described in Requeuing a pull request in the merge queue.

Dequeuing a pull request that others are stacked on top of also removes the ones above it that are still in the queue. See cascade dequeue.

The Mergify API dequeues a pull request without a comment:

Terminal windowbash
curl -X POST \
-H "Authorization: Bearer <token>" \
https://api.mergify.com/v1/repos/<owner>/<repository>/merge-queue/pull/<number>/dequeue

It covers the same two states as the command: it takes the pull request out of the queue, or cancels a queue request still waiting for queue_conditions, including one made through the API. Mergify answers 204 No Content.

The call needs the same credentials as queueing, and the command restrictions set for dequeue apply to it. When Mergify refuses the request, the response body carries an error_code:

Status error_code Meaning
403 COMMAND_RESTRICTED Your commands_restrictions don’t let the caller dequeue this pull request.
404 PULL_REQUEST_NOT_QUEUED The pull request is neither in the queue nor waiting to enter it.
422 CONFIGURATION_INVALID The repository’s Mergify configuration is invalid.

The request is recorded as a command.dequeue event, with the fields described in the event log.

Was this page helpful?