git.pulls.get

Show a pull request with mergeability, checks and approvals

GET /git/api/repositories/{repoId}/pulls/{prNumber}IAM git:GetPullRequestRead

The diff is included only for a caller who also holds git:PullRepository; `canReadSource` in the response says which happened.

Without git:PullRepository the answer is reduced rather than refused.

Request syntax

GET /git/api/repositories/{repoId}/pulls/{prNumber}

Path parameters

  • repoIdRequired

    string

    Constraints: uuid

  • prNumberRequired

    number

    Constraints: integer, min 1

Response

200 with the pull request, its mergeability recomputed (mergeStatus, sourceOid, targetOid, conflicts), `diff` (or null), `canReadSource`, `checks`, `approvals`, `codeOwners` and `mergeQueue`.

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

Fields of data

  • idAlways

    string

    The pull request id
  • orgIdAlways

    string

    The organization that owns it
  • repoIdAlways

    string

    The repository it belongs to
  • numberAlways

    number

    Its number in the repository, as in #12
  • titleAlways

    string

    The title
  • bodyAlways

    string, may be null

    The description (Markdown); null when there is none
  • stateAlways

    one of open, closed, merged, draft

    open, draft, closed (without merging) or merged
  • sourceBranchAlways

    string

    The branch with the changes
  • targetBranchAlways

    string

    The branch it merges into
  • sourceOidAlways

    string, may be null

    Head commit of the source branch when mergeability was last computed
  • targetOidAlways

    string, may be null

    Tip of the target branch when mergeability was last computed
  • mergeStatusAlways

    one of unknown, mergeable, conflicted, up_to_date

    Whether it merges cleanly: mergeable, conflicted, up_to_date (nothing to merge) or unknown
  • mergeConflictsAlways

    array of string, may be null

    The conflicting paths when conflicted; null when not known
  • mergeCommitOidAlways

    string, may be null

    The commit the merge produced; null until merged
  • authorIamUserIdAlways

    string

    The IAM user who opened it (for an imported one, who ran the import)
  • isDraftAlways

    boolean

    A draft, not yet ready for review
  • mergedAtAlways

    string, may be null

    When it was merged; null unless merged
  • closedAtAlways

    string, may be null

    When it was closed; null while open
  • externalAuthorAlways

    string, may be null

    For an imported pull request, who opened it at the source; null otherwise
  • externalUrlAlways

    string, may be null

    For an imported pull request, its address at the source; null otherwise
  • autoMergeMethodAlways

    one of merge, squash, rebase, may be null

    The method auto-merge will use; null when auto-merge is off
  • autoMergeIamUserIdAlways

    string, may be null

    Who turned auto-merge on, and as whom it merges; null when off
  • autoMergeEnabledAtAlways

    string, may be null

    When auto-merge was turned on; null when off
  • autoMergeBlockedReasonAlways

    string, may be null

    Why the last auto-merge attempt did not merge; null when nothing blocks it
  • createdAtAlways

    string

    When it was opened
  • updatedAtAlways

    string

    When it last changed
  • conflictsAlways

    array of string

    The paths that conflict, recomputed now; empty when it merges cleanly
  • diffAlways

    object, may be null

    The changes; null without git:PullRepository or when a branch is gone
  • diff.​patchAlways

    string

    The unified diff of what the pull request proposes
  • diff.​filesChangedAlways

    number

    Files changed
  • diff.​insertionsAlways

    number

    Lines added
  • diff.​deletionsAlways

    number

    Lines removed
  • diff.​truncatedAlways

    boolean

    True when the patch holds only the first files because the whole is too large
  • canReadSourceAlways

    boolean

    False when the diff was withheld for lack of git:PullRepository
  • checksAlways

    object, may be null

    Status checks on the head commit; null when the source branch is gone
  • checks.​passedAlways

    boolean

    Status checks allow the merge
  • checks.​requiredAlways

    boolean

    A protection rule on the target requires checks
  • checks.​pendingAlways

    boolean

    Checks are still running and may yet pass
  • checks.​checksAlways

    array of object

    Each check on the head commit
  • checks.​checks[].​workflowNameAlways

    string

    The workflow, job or commit status context checked
  • checks.​checks[].​runIdAlways

    string

    The CI run; `status:<id>` for a reported commit status, empty while none has run
  • checks.​checks[].​runNumberAlways

    number

    The run number; 0 for a commit status or a check with no run yet
  • checks.​checks[].​statusAlways

    one of queued, provisioning, running, succeeded, failed, cancelled, timed_out

    Where the check stands
  • checks.​checks[].​requiredWhen present

    boolean

    Whether the check gates the merge
  • checks.​checks[].​versionWhen present

    one of protected, proposed

    Whether the run used the workflow file of the target branch (protected) or the pull request's (proposed)
  • checks.​checks[].​commitStatusWhen present

    object

    Present when the check is a commit status an external tool reported
  • checks.​checks[].​commitStatus.​contextAlways

    string

    The context the external tool reported
  • checks.​checks[].​commitStatus.​descriptionAlways

    string, may be null

    Its short summary; null when none was given
  • checks.​checks[].​commitStatus.​targetUrlAlways

    string, may be null

    Link to the details; null when none was given
  • checks.​reasonWhen present

    string

    Why the checks block the merge; absent when they pass
  • approvalsAlways

    object

    Where the required approvals stand
  • approvals.​passedAlways

    boolean

    Approvals allow the merge
  • approvals.​requiredAlways

    number

    Approvals the target branch requires; 0 when none
  • approvals.​countedAlways

    number

    Approvals that count toward the requirement
  • approvals.​dismissedAlways

    number

    Approvals not counted because the branch moved after them
  • approvals.​reasonWhen present

    string

    Why approvals block the merge; absent when they pass
  • codeOwnersAlways

    object

    Where code owner review stands
  • codeOwners.​requiredAlways

    boolean

    The target branch requires code owner review
  • codeOwners.​passedAlways

    boolean

    Code owner review allows the merge
  • codeOwners.​missingAlways

    array of object

    Changed files still waiting for an approval by an owner
  • codeOwners.​missing[].​pathAlways

    string

    A changed file
  • codeOwners.​missing[].​ownersAlways

    array of string

    Its owners, as CODEOWNERS names them
  • codeOwners.​reasonWhen present

    string

    Why code owners block the merge; absent when they pass
  • mergeQueueAlways

    object

    Where it stands in the merge queue of its target
  • mergeQueue.​requiredAlways

    boolean

    The target branch requires the merge queue
  • mergeQueue.​configAlways

    object, may be null

    The queue settings; null when no queue
  • mergeQueue.​config.​ruleIdAlways

    string

    The branch protection rule that requires the queue
  • mergeQueue.​config.​methodAlways

    one of merge, squash, rebase

    How queued pull requests are merged
  • mergeQueue.​config.​buildConcurrencyAlways

    number

    Builds that may run at once
  • mergeQueue.​config.​minGroupSizeAlways

    number

    Fewest pull requests merged together
  • mergeQueue.​config.​maxGroupSizeAlways

    number

    Most pull requests merged together
  • mergeQueue.​config.​waitMinutesAlways

    number

    Minutes to wait for the minimum group to fill
  • mergeQueue.​config.​checkTimeoutMinutesAlways

    number

    Minutes a build may take before it counts as failed
  • mergeQueue.​config.​onlyNonFailingAlways

    boolean

    A failed build removes its pull request at once, rather than waiting on later builds
  • mergeQueue.​entryAlways

    object, may be null

    Its live queue entry, or how the last attempt ended; null when never queued
  • mergeQueue.​entry.​idAlways

    string

    The queue entry id
  • mergeQueue.​entry.​orgIdAlways

    string

    The organization that owns it
  • mergeQueue.​entry.​repoIdAlways

    string

    The repository
  • mergeQueue.​entry.​prIdAlways

    string

    The pull request queued
  • mergeQueue.​entry.​baseBranchAlways

    string

    The protected branch the queue merges into
  • mergeQueue.​entry.​stateAlways

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

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

    number

    Sort key in the queue: a larger one is further back
  • mergeQueue.​entry.​headOidAlways

    string, may be null

    Pull request head when it joined the line; null while waiting
  • mergeQueue.​entry.​baseOidAlways

    string, may be null

    The commit its build sits on; null until built
  • mergeQueue.​entry.​groupOidAlways

    string, may be null

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

    string, may be null

    The temporary branch built; null until built
  • mergeQueue.​entry.​mergeMethodAlways

    one of merge, squash, rebase, may be null

    How it will be merged
  • mergeQueue.​entry.​enqueuedByIamUserIdAlways

    string, may be null

    Who added it; null when that IAM user is gone
  • mergeQueue.​entry.​removalReasonAlways

    string, may be null

    Why it left the queue; null unless removed
  • mergeQueue.​entry.​queuedAtAlways

    string, may be null

    When it joined the line; null while waiting
  • mergeQueue.​entry.​buildStartedAtAlways

    string, may be null

    When its build started; null until then
  • mergeQueue.​entry.​finishedAtAlways

    string, may be null

    When it merged or left; null while in the queue
  • mergeQueue.​entry.​createdAtAlways

    string

    When it was added
  • mergeQueue.​entry.​updatedAtAlways

    string

    When it last changed
  • mergeQueue.​positionAlways

    number, may be null

    1-based place in line; null while waiting or once finished
  • mergeQueue.​eventsAlways

    array of object

    Its last 30 queue events, newest first
  • mergeQueue.​events[].​idAlways

    string

    The event id
  • mergeQueue.​events[].​orgIdAlways

    string

    The organization
  • mergeQueue.​events[].​repoIdAlways

    string

    The repository
  • mergeQueue.​events[].​baseBranchAlways

    string

    The queue, by its branch
  • mergeQueue.​events[].​entryIdAlways

    string, may be null

    The queue entry concerned; null for the queue as a whole
  • mergeQueue.​events[].​prIdAlways

    string, may be null

    The pull request concerned; null for the queue as a whole
  • mergeQueue.​events[].​kindAlways

    one of waiting, queued, build_started, checks_passed, checks_failed, conflict, rebuild, merged, removed

    What happened
  • mergeQueue.​events[].​detailAlways

    string, may be null

    A sentence on what happened and why
  • mergeQueue.​events[].​actorIamUserIdAlways

    string, may be null

    Who acted; null when the queue itself did
  • mergeQueue.​events[].​commitOidAlways

    string, may be null

    The commit concerned, if any
  • mergeQueue.​events[].​createdAtAlways

    string

    When it happened
  • mergeQueue.​events[].​prNumberAlways

    number, may be null

    The pull request number; null when none
  • mergeQueue.​events[].​actorAlways

    string, may be null

    The actor's username; null when the queue acted

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:GetPullRequest 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 pulls get 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_pulls_get.