octokit.pulls.checkIfMerged({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes |
See also: GitHub Developer Guide documentation.
Draft 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.
You can create a new pull request.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.create({owner,repo,head,base,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
title | no | The title of the new pull request. |
head | yes | The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace |
base | yes | The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. |
body | no | The contents of the pull request. |
maintainer_can_modify | no | Indicates whether maintainers can modify the pull request. |
draft | no | Indicates whether the pull request is a draft. See "Draft Pull Requests" in the GitHub Help documentation to learn more. |
issue | no |
See also: GitHub Developer Guide documentation.
Creates a reply to a review comment for a pull request. For the comment_id
, provide the ID of the review comment you are replying to. This must be the ID of a top-level review comment, not a reply to that comment. Replies to replies are not supported.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.createReplyForReviewComment({owner,repo,pull_number,comment_id,body,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
comment_id | yes | comment_id parameter |
body | yes | The text of the review comment. |
See also: GitHub Developer Guide documentation.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
Pull request reviews created in the PENDING
state do not include the submitted_at
property in the response.
Note: To comment on a specific line in a file, you need to first determine the position of that line in the diff. The GitHub REST API v3 offers the application/vnd.github.v3.diff
media type. To see a pull request diff, add this media type to the Accept
header of a call to the single pull request endpoint.
The position
value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
octokit.pulls.createReview({owner,repo,pull_number,comments[].path,comments[].body})
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
commit_id | no | The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the |
body | no | Required when using |
event | no | The review action you want to perform. The review actions include: |
comments | no | Use the following table to specify the location, destination, and contents of the draft review comment. |
comments[].path | yes | The relative path to the file that necessitates a review comment. |
comments[].position | no | The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below. |
comments[].body | yes | Text of the review comment. |
comments[].line | no | |
comments[].side | no | |
comments[].start_line | no | |
comments[].start_side | no |
See also: GitHub Developer Guide documentation.
Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "Create an issue comment." We recommend creating a review comment using line
, side
, and optionally start_line
and start_side
if your comment applies to more than one line in the pull request diff.
You can still create a review comment using the position
parameter. When you use position
, the line
, side
, start_line
, and start_side
parameters are not required. For more information, see the comfort-fade
preview notice.
Note: The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.createReviewComment({owner,repo,pull_number,body,path,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
body | yes | The text of the review comment. |
commit_id | no | The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the |
path | yes | The relative path to the file that necessitates a comment. |
position | no | Required without |
side | no | Required with |
line | no | Required with |
start_line | no | Required when using multi-line comments. To create multi-line comments, you must use the |
start_side | no | Required when using multi-line comments. To create multi-line comments, you must use the |
in_reply_to | no |
See also: GitHub Developer Guide documentation.
octokit.pulls.deletePendingReview({owner,repo,pull_number,review_id,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
See also: GitHub Developer Guide documentation.
Deletes a review comment.
octokit.pulls.deleteReviewComment({owner,repo,comment_id,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
comment_id | yes | comment_id parameter |
See also: GitHub Developer Guide documentation.
Note: To dismiss a pull request review on a protected branch, you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews.
octokit.pulls.dismissReview({owner,repo,pull_number,review_id,message,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
message | yes | The message for the pull request review dismissal |
event | no |
See also: GitHub Developer Guide documentation.
Draft 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:
merge_commit_sha
represents the SHA of the merge commit.merge_commit_sha
represents the SHA of the squashed commit on the base branch.merge_commit_sha
represents the commit that the base branch was updated to.Pass the appropriate media type to fetch diff and patch formats.
octokit.pulls.get({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes |
See also: GitHub Developer Guide documentation.
octokit.pulls.getReview({owner,repo,pull_number,review_id,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
See also: GitHub Developer Guide documentation.
Provides details for a review comment.
octokit.pulls.getReviewComment({owner,repo,comment_id,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
comment_id | yes | comment_id parameter |
See also: GitHub Developer Guide documentation.
Draft 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.
octokit.pulls.list({owner,repo,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
state | no | Either |
head | no | Filter pulls by head user or head organization and branch name in the format of |
base | no | Filter pulls by base branch name. Example: |
sort | no | What to sort results by. Can be either |
direction | no | The direction of the sort. Can be either |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
List comments for a specific pull request review.
octokit.pulls.listCommentsForReview({owner,repo,pull_number,review_id,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the List commits endpoint.
octokit.pulls.listCommits({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Note: Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default.
octokit.pulls.listFiles({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
octokit.pulls.listRequestedReviewers({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists all review comments for a pull request. By default, review comments are in ascending order by ID.
octokit.pulls.listReviewComments({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
sort | no | One of |
direction | no | Can be either |
since | no | Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID.
octokit.pulls.listReviewCommentsForRepo({owner,repo,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
sort | no | One of |
direction | no | Can be either |
since | no | Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
The list of reviews returns in chronological order.
octokit.pulls.listReviews({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
per_page | no | Results per page (max 100) |
page | no | Page number of the results to fetch. |
See also: GitHub Developer Guide documentation.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.merge({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
commit_title | no | Title for the automatic commit message. |
commit_message | no | Extra detail to append to automatic commit message. |
sha | no | SHA that pull request head must match to allow merge. |
merge_method | no | Merge method to use. Possible values are |
See also: GitHub Developer Guide documentation.
octokit.pulls.removeRequestedReviewers({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
reviewers | no | An array of user |
team_reviewers | no | An array of team |
See also: GitHub Developer Guide documentation.
This endpoint triggers notifications. Creating content too quickly using this endpoint may result in abuse rate limiting. See "Abuse rate limits" and "Dealing with abuse rate limits" for details.
octokit.pulls.requestReviewers({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
reviewers | no | An array of user |
team_reviewers | no | An array of team |
See also: GitHub Developer Guide documentation.
octokit.pulls.submitReview({owner,repo,pull_number,review_id,event,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
body | no | The body text of the pull request review |
event | yes | The review action you want to perform. The review actions include: |
See also: GitHub Developer Guide documentation.
Draft 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.
octokit.pulls.update({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
title | no | The title of the pull request. |
body | no | The contents of the pull request. |
state | no | State of this Pull Request. Either |
base | no | The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. |
maintainer_can_modify | no | Indicates whether maintainers can modify the pull request. |
See also: GitHub Developer Guide documentation.
Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch.
octokit.pulls.updateBranch({owner,repo,pull_number,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
expected_head_sha | no | The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a |
See also: GitHub Developer Guide documentation.
Update the review summary comment with new text.
octokit.pulls.updateReview({owner,repo,pull_number,review_id,body,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
pull_number | yes | |
review_id | yes | review_id parameter |
body | yes | The body text of the pull request review. |
See also: GitHub Developer Guide documentation.
Enables you to edit a review comment.
octokit.pulls.updateReviewComment({owner,repo,comment_id,body,});
name | required | description |
---|---|---|
owner | yes | |
repo | yes | |
comment_id | yes | comment_id parameter |
body | yes | The text of the reply to the review comment. |
See also: GitHub Developer Guide documentation.