Create a review comment for a pull request
POST
/repos/{owner}/{repo}/pulls/{pull_number}/comments
pulls
line
, side
, and optionally start_line
and start_side
if your comment applies to more than one line in the pull request diff.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.请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.github.com/repos///pulls//comments' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "Great stuff!",
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"line": 2,
"path": "file1.txt",
"side": "RIGHT",
"start_line": 1,
"start_side": "RIGHT"
}'
响应示例响应示例
201 - 示例 1
{
"_links": {
"html": {
"href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
},
"pull_request": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
},
"self": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
}
},
"author_association": "OWNER",
"body": "We should probably include a check for null values here.",
"body_html": "\"<p>comment body</p>\"",
"body_text": "\"comment body\"",
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"created_at": "2011-04-14T16:00:49Z",
"diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
"html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
"id": 1,
"in_reply_to_id": 8,
"line": 2,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw",
"original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
"original_line": 2,
"original_position": 4,
"original_start_line": 2,
"path": "config/database.yaml",
"position": 1,
"pull_request_review_id": 42,
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
"reactions": {
"+1": 0,
"-1": 0,
"confused": 0,
"eyes": 0,
"heart": 0,
"hooray": 0,
"laugh": 0,
"rocket": 0,
"total_count": 0,
"url": "http://example.com"
},
"side": "RIGHT",
"start_line": 2,
"start_side": "RIGHT",
"updated_at": "2011-04-14T16:00:49Z",
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
"user": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "41d064eb2195891e12d0413f63227ea7",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": true,
"starred_at": "\"2020-07-09T00:17:55Z\"",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
}
}
请求参数
Path 参数
owner
string
必需
repo
string
必需
pull_number
integer
必需
Body 参数application/json