Skip to main content

comments

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

Overview

Namecomments
TypeResource
Idgithub.pulls.comments

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger (int64)The ID of the pull request review comment.
commit_idstringThe SHA of the commit to which the comment applies. (example: 6dcb09b5b57875f334f61aebed695e2e4193db5e)
in_reply_to_idintegerThe comment ID to reply to.
node_idstringThe node ID of the pull request review comment. (example: MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw)
original_commit_idstringThe SHA of the original commit to which the comment applies. (example: 9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840)
pull_request_review_idinteger (int64)The ID of the pull request review to which the comment belongs.
_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 comment. (example: We should probably include a check for null values here.)
body_htmlstring (example: "

comment body

")
body_textstring (example: "comment body")
created_atstring (date-time) (example: 2011-04-14T16:00:49Z)
diff_hunkstringThe diff of the line that the comment refers to. (example: @@ -16,33 +16,40 @@ public class Connection : IConnection...)
html_urlstring (uri)HTML URL for the pull request review comment. (example: https://github.com/octocat/Hello-World/pull/1#discussion-diff-1)
lineintegerThe line of the blob to which the comment applies. The last line of the range for a multi-line comment
original_lineintegerThe line of the blob to which the comment applies. The last line of the range for a multi-line comment
original_positionintegerThe index of the original line in the diff to which the comment applies. This field is closing down; use original_line instead.
original_start_lineintegerThe first line of the range for a multi-line comment.
pathstringThe relative path of the file to which the comment applies. (example: config/database.yaml)
positionintegerThe line index in the diff to which the comment applies. This field is closing down; use line instead.
pull_request_urlstring (uri)URL for the pull request that the review comment belongs to. (example: https://api.github.com/repos/octocat/Hello-World/pulls/1)
reactionsobject (title: Reaction Rollup)
sidestringThe side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment (LEFT, RIGHT) (default: RIGHT)
start_lineintegerThe first line of the range for a multi-line comment.
start_sidestringThe side of the first line of the range for a multi-line comment. (LEFT, RIGHT) (default: RIGHT)
subject_typestringThe level at which the comment is targeted, can be a diff line or a file. (line, file)
updated_atstring (date-time) (example: 2011-04-14T16:00:49Z)
urlstringURL for the pull request review comment (example: https://api.github.com/repos/octocat/Hello-World/pulls/comments/1)
userobjectA GitHub user. (title: Simple User)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_review_commentselectowner, repo, comment_idProvides details for a specified review 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.
list_review_commentsselectowner, repo, pull_numbersort, direction, since, per_page, pageLists all review comments for a specified pull request. By default, review comments
are in ascending order by 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_review_comments_for_reposelectowner, reposort, direction, since, per_page, pageLists review comments for all pull requests in a repository. By default,
review comments are in ascending order by 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.
create_reply_for_review_commentinsertowner, repo, pull_number, comment_id, bodyCreates 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 secondary rate limiting. For more information, see "Rate limits for the API"
and "Best practices for using the REST API."

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_commentinsertowner, repo, pull_number, body, commit_id, pathCreates a review comment on the diff of a specified pull request. To add a regular comment to a pull request timeline, see "Create an issue comment."

If your comment applies to more than one line in the pull request diff, you should use the parameters line, side, and optionally start_line and start_side in your request.

The position parameter is closing down. If you use position, the line, side, start_line, and start_side parameters are not required.

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."

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_commentupdateowner, repo, comment_id, bodyEdits the content of a specified review 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_review_commentdeleteowner, repo, comment_idDeletes a review comment.

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
comment_idinteger (int64)The unique identifier of the comment.
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.
directionstringThe direction to sort results. Ignored without sort parameter.
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."
sincestring (date-time)Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
sortstring

SELECT examples

Provides details for a specified review 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.

SELECT
id,
commit_id,
in_reply_to_id,
node_id,
original_commit_id,
pull_request_review_id,
_links,
author_association,
body,
body_html,
body_text,
created_at,
diff_hunk,
html_url,
line,
original_line,
original_position,
original_start_line,
path,
position,
pull_request_url,
reactions,
side,
start_line,
start_side,
subject_type,
updated_at,
url,
user
FROM github.pulls.comments
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND comment_id = '{{ comment_id }}' -- required
;

INSERT examples

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 secondary rate limiting. For more information, see "Rate limits for the API"
and "Best practices for using the REST API."

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.comments (
body,
owner,
repo,
pull_number,
comment_id
)
SELECT
'{{ body }}' /* required */,
'{{ owner }}',
'{{ repo }}',
'{{ pull_number }}',
'{{ comment_id }}'
RETURNING
id,
commit_id,
in_reply_to_id,
node_id,
original_commit_id,
pull_request_review_id,
_links,
author_association,
body,
body_html,
body_text,
created_at,
diff_hunk,
html_url,
line,
original_line,
original_position,
original_start_line,
path,
position,
pull_request_url,
reactions,
side,
start_line,
start_side,
subject_type,
updated_at,
url,
user
;

UPDATE examples

Edits the content of a specified review 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.

UPDATE github.pulls.comments
SET
body = '{{ body }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND comment_id = '{{ comment_id }}' --required
AND body = '{{ body }}' --required
RETURNING
id,
commit_id,
in_reply_to_id,
node_id,
original_commit_id,
pull_request_review_id,
_links,
author_association,
body,
body_html,
body_text,
created_at,
diff_hunk,
html_url,
line,
original_line,
original_position,
original_start_line,
path,
position,
pull_request_url,
reactions,
side,
start_line,
start_side,
subject_type,
updated_at,
url,
user;

DELETE examples

Deletes a review comment.

DELETE FROM github.pulls.comments
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND comment_id = '{{ comment_id }}' --required
;