git.merge-queue.add

Add a pull request to its target branch merge queue ("merge when ready")

POST /git/api/repositories/{repoId}/pulls/{prNumber}/merge-queueIAM git:AddToMergeQueueChanges state

Only for a target branch whose protection rule requires a merge queue. If approvals or checks are not yet satisfied the entry waits (state `waiting`) and joins the end of the line once they are. The queue builds `ews-readonly-queue/<base>/pr-<n>-<sha>` with every pull request ahead of it, runs `merge_group` CI on it, and fast-forwards the base when the checks pass.

Request syntax

POST /git/api/repositories/{repoId}/pulls/{prNumber}/merge-queue

Path parameters

  • repoIdRequired

    string

    Constraints: uuid

  • prNumberRequired

    number

    Constraints: integer, min 1

Response

201 with the queue entry: state `queued`, or `waiting` until approvals and checks pass. 409 for a draft, a closed pull request, or one already queued.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • idAlways

    string

    The queue entry id
  • orgIdAlways

    string

    The organization that owns it
  • repoIdAlways

    string

    The repository
  • prIdAlways

    string

    The pull request queued
  • baseBranchAlways

    string

    The protected branch the queue merges into
  • stateAlways

    one of waiting, queued, building, passed, failed, merged, removed

    waiting (for approvals and checks), queued, building, passed, failed, merged or removed
  • positionAlways

    number

    Sort key in the queue: a larger one is further back
  • headOidAlways

    string, may be null

    Pull request head when it joined the line; null while waiting
  • baseOidAlways

    string, may be null

    The commit its build sits on; null until built
  • groupOidAlways

    string, may be null

    The commit built: the base, every entry ahead, and this one; null until built
  • tempRefAlways

    string, may be null

    The temporary branch built; null until built
  • mergeMethodAlways

    one of merge, squash, rebase, may be null

    How it will be merged
  • enqueuedByIamUserIdAlways

    string, may be null

    Who added it; null when that IAM user is gone
  • removalReasonAlways

    string, may be null

    Why it left the queue; null unless removed
  • queuedAtAlways

    string, may be null

    When it joined the line; null while waiting
  • buildStartedAtAlways

    string, may be null

    When its build started; null until then
  • finishedAtAlways

    string, may be null

    When it merged or left; null while in the queue
  • createdAtAlways

    string

    When it was added
  • updatedAtAlways

    string

    When it last changed

Checked against the handlers: every route test validates their answers against this schema.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow git:AddToMergeQueue on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud git merge-queue add repoId prNumber

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_git_merge-queue_add.