Skip to main content

reviews

Creates, updates, deletes, gets or lists a reviews resource.

Overview

Namereviews
TypeResource
Idgithub.pulls.reviews

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger (int64)Unique identifier of the review
commit_idstringA commit SHA for the review. If the commit object was garbage collected or forcibly deleted, then it no longer exists in Git and this value will be null. (example: 54bb654c9e6025347f57900a4a5c2313a96b8035)
node_idstring (example: MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=)
_linksobject
author_associationstringHow the author is associated with the repository. (COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER) (title: author_association, example: OWNER)
bodystringThe text of the review. (example: This looks great.)
body_htmlstring
body_textstring
html_urlstring (uri) (example: https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80)
pull_request_urlstring (uri) (example: https://api.github.com/repos/octocat/Hello-World/pulls/12)
statestring (example: CHANGES_REQUESTED)
submitted_atstring (date-time)
userobjectA GitHub user. (title: Simple User)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_reviewselectowner, repo, pull_number, review_idRetrieves a pull request review by its ID.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
list_reviewsselectowner, repo, pull_numberper_page, pageLists all reviews for a specified pull request. The list of reviews returns in chronological order.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
create_reviewinsertowner, repo, pull_numberCreates a review on a specified pull request.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."

Pull request reviews created in the PENDING state are not submitted and therefore do not include the submitted_at property in the response. To create a pending review for a pull request, leave the event parameter blank. For more information about submitting a PENDING review, see "Submit a review for a pull request."

> [!NOTE]
> To comment on a specific line in a file, you need to first determine the position of that line in the diff. To see a pull request diff, add the application/vnd.github.v3.diff media type to the Accept header of a call to the Get a 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.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
update_reviewreplaceowner, repo, pull_number, review_id, bodyUpdates the contents of a specified review summary comment.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
delete_pending_reviewdeleteowner, repo, pull_number, review_idDeletes a pull request review that has not been submitted. Submitted reviews cannot be deleted.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
dismiss_reviewexecowner, repo, pull_number, review_id, messageDismisses a specified review on a pull request.

> [!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.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
submit_reviewexecowner, repo, pull_number, review_id, eventSubmits a pending review for a pull request. For more information about creating a pending review for a pull request, see "Create a review for a pull request."

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
ownerstringThe account owner of the repository. The name is not case sensitive.
pull_numberintegerThe number that identifies the pull request.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
review_idintegerThe unique identifier of the review.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

Retrieves a pull request review by its ID.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

SELECT
id,
commit_id,
node_id,
_links,
author_association,
body,
body_html,
body_text,
html_url,
pull_request_url,
state,
submitted_at,
user
FROM github.pulls.reviews
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND pull_number = '{{ pull_number }}' -- required
AND review_id = '{{ review_id }}' -- required
;

INSERT examples

Creates a review on a specified pull request.

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "Rate limits for the API" and "Best practices for using the REST API."

Pull request reviews created in the PENDING state are not submitted and therefore do not include the submitted_at property in the response. To create a pending review for a pull request, leave the event parameter blank. For more information about submitting a PENDING review, see "Submit a review for a pull request."

> [!NOTE]
> To comment on a specific line in a file, you need to first determine the position of that line in the diff. To see a pull request diff, add the application/vnd.github.v3.diff media type to the Accept header of a call to the Get a 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.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

INSERT INTO github.pulls.reviews (
commit_id,
body,
event,
comments,
owner,
repo,
pull_number
)
SELECT
'{{ commit_id }}',
'{{ body }}',
'{{ event }}',
'{{ comments }}',
'{{ owner }}',
'{{ repo }}',
'{{ pull_number }}'
RETURNING
id,
commit_id,
node_id,
_links,
author_association,
body,
body_html,
body_text,
html_url,
pull_request_url,
state,
submitted_at,
user
;

REPLACE examples

Updates the contents of a specified review summary comment.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

REPLACE github.pulls.reviews
SET
body = '{{ body }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND pull_number = '{{ pull_number }}' --required
AND review_id = '{{ review_id }}' --required
AND body = '{{ body }}' --required
RETURNING
id,
commit_id,
node_id,
_links,
author_association,
body,
body_html,
body_text,
html_url,
pull_request_url,
state,
submitted_at,
user;

DELETE examples

Deletes a pull request review that has not been submitted. Submitted reviews cannot be deleted.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

DELETE FROM github.pulls.reviews
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND pull_number = '{{ pull_number }}' --required
AND review_id = '{{ review_id }}' --required
;

Lifecycle Methods

Dismisses a specified review on a pull request.

> [!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.

This endpoint supports the following custom media types. For more information, see "Media types."

- application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
- application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
- application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
- application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.

EXEC github.pulls.reviews.dismiss_review 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@pull_number='{{ pull_number }}' --required,
@review_id='{{ review_id }}' --required
@@json=
'{
"message": "{{ message }}",
"event": "{{ event }}"
}'
;