Skip to main content

pull_request

Overview

Namepull_request
TypeResource
Idgithub.pulls.pull_request

Fields

NameDatatypeDescription
idinteger
auto_mergeobjectThe status of auto merging a pull request.
additionsinteger
closed_atstring
changed_filesinteger
diff_urlstring
html_urlstring
mergeableboolean
statuses_urlstring
requested_teamsarray
review_commentsinteger
mergedboolean
titlestringThe title of the pull request.
updated_atstring
labelsarray
statestringState of this Pull Request. Either open or closed.
mergeable_statestring
draftbooleanIndicates whether or not the pull request is a draft.
merged_byobjectA GitHub user.
headobject
author_associationstringHow the author is associated with the repository.
userobjectA GitHub user.
node_idstring
issue_urlstring
commentsinteger
created_atstring
commits_urlstring
review_comment_urlstring
numberintegerNumber uniquely identifying the pull request within its repository.
active_lock_reasonstring
comments_urlstring
requested_reviewersarray
commitsinteger
review_comments_urlstring
_linksobject
deletionsinteger
assigneesarray
merged_atstring
patch_urlstring
milestoneobjectA collection of related issues and pull requests.
urlstring
assigneeobjectA GitHub user.
merge_commit_shastring
rebaseableboolean
baseobject
lockedboolean
maintainer_can_modifybooleanIndicates whether maintainers can modify the pull request.
bodystring

Methods

NameAccessible byRequired ParamsDescription
getSELECTowner, pull_number, repoDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

Lists details of a pull request by providing its number.

When you get, create, or edit a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the mergeable key. For more information, see "Checking mergeability of pull requests".

The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. If mergeable is true, then merge_commit_sha will be the SHA of the test merge commit.

The value of the merge_commit_sha attribute changes depending on the state of the pull request. Before merging a pull request, the merge_commit_sha attribute holds the SHA of the test merge commit. After merging a pull request, the merge_commit_sha attribute changes depending on how you merged the pull request:

If merged as a merge commit, merge_commit_sha represents the SHA of the merge commit.
If merged via a squash, merge_commit_sha represents the SHA of the squashed commit on the base branch.
* If rebased, merge_commit_sha represents the commit that the base branch was updated to.

Pass the appropriate media type to fetch diff and patch formats.
createINSERTowner, repo, data__base, data__headDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See "Secondary rate limits" and "Dealing with secondary rate limits" for details.
check_if_mergedEXECowner, pull_number, repoChecks if a pull request has been merged into the base branch. The HTTP status of the response indicates whether or not the pull request has been merged; the response body is empty.
mergeEXECowner, pull_number, repoMerges a pull request into the base branch.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See "Secondary rate limits" and "Dealing with secondary rate limits" for details.
updateEXECowner, pull_number, repoDraft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see GitHub's products in the GitHub Help documentation.

To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request.
update_branchEXECowner, pull_number, repoUpdates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch.