reviews
Creates, updates, deletes, gets or lists a reviews resource.
Overview
| Name | reviews |
| Type | Resource |
| Id | github.pulls.reviews |
Fields
The following fields are returned by SELECT queries:
- get_review
- list_reviews
Response
| Name | Datatype | Description |
|---|---|---|
id | integer (int64) | Unique identifier of the review |
commit_id | string | A 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_id | string | (example: MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=) |
_links | object | |
author_association | string | How the author is associated with the repository. (COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER) (title: author_association, example: OWNER) |
body | string | The text of the review. (example: This looks great.) |
body_html | string | |
body_text | string | |
html_url | string (uri) | (example: https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80) |
pull_request_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/pulls/12) |
state | string | (example: CHANGES_REQUESTED) |
submitted_at | string (date-time) | |
user | object | A GitHub user. (title: Simple User) |
The list of reviews returns in chronological order.
| Name | Datatype | Description |
|---|---|---|
id | integer (int64) | Unique identifier of the review |
commit_id | string | A 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_id | string | (example: MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=) |
_links | object | |
author_association | string | How the author is associated with the repository. (COLLABORATOR, CONTRIBUTOR, FIRST_TIMER, FIRST_TIME_CONTRIBUTOR, MANNEQUIN, MEMBER, NONE, OWNER) (title: author_association, example: OWNER) |
body | string | The text of the review. (example: This looks great.) |
body_html | string | |
body_text | string | |
html_url | string (uri) | (example: https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80) |
pull_request_url | string (uri) | (example: https://api.github.com/repos/octocat/Hello-World/pulls/12) |
state | string | (example: CHANGES_REQUESTED) |
submitted_at | string (date-time) | |
user | object | A GitHub user. (title: Simple User) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_review | select | owner, repo, pull_number, review_id | 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. | |
list_reviews | select | owner, repo, pull_number | per_page, page | Lists 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_review | insert | owner, repo, pull_number | 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. | |
update_review | replace | owner, repo, pull_number, review_id, body | 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. | |
delete_pending_review | delete | owner, repo, pull_number, review_id | 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. | |
dismiss_review | exec | owner, repo, pull_number, review_id, message | 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. | |
submit_review | exec | owner, repo, pull_number, review_id, event | Submits 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.
| Name | Datatype | Description |
|---|---|---|
owner | string | The account owner of the repository. The name is not case sensitive. |
pull_number | integer | The number that identifies the pull request. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
review_id | integer | The unique identifier of the review. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_review
- list_reviews
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
;
Lists 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.
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 per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_review
- Manifest
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
;
# Description fields are for documentation purposes
- name: reviews
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the reviews resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the reviews resource.
- name: pull_number
value: {{ pull_number }}
description: Required parameter for the reviews resource.
- name: commit_id
value: "{{ commit_id }}"
description: |
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 `position`. Defaults to the most recent commit in the pull request when you do not specify a value.
- name: body
value: "{{ body }}"
description: |
**Required** when using `REQUEST_CHANGES` or `COMMENT` for the `event` parameter. The body text of the pull request review.
- name: event
value: "{{ event }}"
description: |
The review action you want to perform. The review actions include: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`. By leaving this blank, you set the review action state to `PENDING`, which means you will need to [submit the pull request review](https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request) when you are ready.
valid_values: ['APPROVE', 'REQUEST_CHANGES', 'COMMENT']
- name: comments
description: |
Use the following table to specify the location, destination, and contents of the draft review comment.
value:
- path: "{{ path }}"
position: {{ position }}
body: "{{ body }}"
line: {{ line }}
side: "{{ side }}"
start_line: {{ start_line }}
start_side: "{{ start_side }}"
REPLACE examples
- update_review
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
- delete_pending_review
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
- dismiss_review
- submit_review
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 }}"
}'
;
Submits 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.
EXEC github.pulls.reviews.submit_review
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@pull_number='{{ pull_number }}' --required,
@review_id='{{ review_id }}' --required
@@json=
'{
"body": "{{ body }}",
"event": "{{ event }}"
}'
;