拉取请求审查的 REST API 端点
使用 REST API 与拉取请求审查进行交互。
关于拉取请求审查
拉取请求审查是拉取请求上拉取请求审查评论的集合,与状态和可选的正文评论一起分组。
列出拉取请求的审查
列出指定拉取请求的所有审查。审查列表按时间顺序返回。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
“列出拉取请求的审查”的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
“列出拉取请求的审查”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
名称、类型、描述 |
---|
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
“列出拉取请求的审查”的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | 审查列表按时间顺序返回。 |
“列出拉取请求的审查”的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews
审查列表按时间顺序返回。
状态:200
[ { "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "Here is the body for the review.", "state": "APPROVED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" } ]
为拉取请求创建审查
在指定的拉取请求上创建审查。
此端点会触发通知。使用此端点过快地创建内容可能会导致二级速率限制。有关更多信息,请参阅“API 的速率限制”和“使用 REST API 的最佳实践”。
在PENDING
状态下创建的拉取请求审查不会提交,因此响应中不包含submitted_at
属性。要为拉取请求创建挂起的审查,请将event
参数留空。有关提交PENDING
审查的更多信息,请参阅“提交拉取请求的审查”。
注意
要评论文件中的特定行,您需要首先确定该行在差异中的位置。要查看拉取请求差异,请将application/vnd.github.v3.diff
媒体类型添加到对获取拉取请求端点的调用的Accept
标头中。
position
值等于您要添加评论的文件中第一个“@@”块标题以下的行数。紧接在“@@”行下面的行是位置 1,下一行是位置 2,依此类推。差异中的位置将继续通过空格行和附加的块增加,直到新文件的开头。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
“为拉取请求创建审查”的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(写入)
“为拉取请求创建审查”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
名称、类型、描述 | ||||||||
---|---|---|---|---|---|---|---|---|
commit_id 字符串需要审查的提交的 SHA。如果不使用最新的提交 SHA,则如果后续提交修改了您指定为 | ||||||||
body 字符串当使用 | ||||||||
event 字符串您要执行的审查操作。审查操作包括: 可以是以下之一: | ||||||||
comments 对象数组使用下表指定草稿审查评论的位置、目标和内容。 | ||||||||
|
名称、类型、描述 |
---|
path 字符串 必填需要审查评论的文件的相对路径。 |
position 整数您想要添加审查评论的 diff 中的位置。请注意,此值与文件中的行号不同。 |
body 字符串 必填审查评论的文本。 |
line 整数 |
side 字符串 |
start_line 整数 |
start_side 字符串 |
"为拉取请求创建审查" 的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | OK |
403 | Forbidden |
422 | 验证失败,或端点已被滥用。 |
"为拉取请求创建审查" 的代码示例
请求示例
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews \ -d '{"commit_id":"ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091","body":"This is close to perfect! Please address the suggested inline change.","event":"REQUEST_CHANGES","comments":[{"path":"file.md","position":6,"body":"Please add more information here, and fix this typo."}]}'
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "This is close to perfect! Please address the suggested inline change.", "state": "CHANGES_REQUESTED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }
获取拉取请求审查
通过其 ID 检索拉取请求审查。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
"获取拉取请求审查" 的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
"获取拉取请求审查" 的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
"获取拉取请求审查" 的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
"获取拉取请求审查" 的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "Here is the body for the review.", "state": "APPROVED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }
更新拉取请求审查
更新指定审查摘要评论的内容。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
"更新拉取请求审查" 的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(写入)
"更新拉取请求审查" 的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
名称、类型、描述 |
---|
body 字符串 必填拉取请求审查的正文文本。 |
"更新拉取请求审查" 的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | OK |
422 | 验证失败,或端点已被滥用。 |
"更新拉取请求审查" 的代码示例
请求示例
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID \ -d '{"body":"This is close to perfect! Please address the suggested inline change. And add more about this."}'
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "This is close to perfect! Please address the suggested inline change. And add more about this.", "state": "CHANGES_REQUESTED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }
删除挂起的拉取请求审查
删除尚未提交的拉取请求审查。已提交的审查无法删除。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
"删除挂起的拉取请求审查" 的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(写入)
"删除挂起的拉取请求审查" 的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
"删除挂起的拉取请求审查" 的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
422 | 验证失败,或端点已被滥用。 |
"删除挂起的拉取请求审查" 的代码示例
请求示例
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "This is close to perfect! Please address the suggested inline change.", "state": "CHANGES_REQUESTED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }
列出拉取请求审查的评论
列出特定拉取请求审查的评论。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
"列出拉取请求审查的评论" 的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
"列出拉取请求审查的评论" 的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
名称、类型、描述 |
---|
per_page 整数每页的结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
"列出拉取请求审查的评论" 的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
"列出拉取请求审查的评论" 的代码示例
请求示例
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID/comments
响应
状态:200
[ { "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1", "pull_request_review_id": 42, "id": 10, "node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw", "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...", "path": "file1.txt", "position": 1, "original_position": 4, "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e", "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840", "in_reply_to_id": 8, "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "Great stuff!", "created_at": "2011-04-14T16:00:49Z", "updated_at": "2011-04-14T16:00:49Z", "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1", "author_association": "NONE", "_links": { "self": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" }, "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" } } } ]
驳回拉取请求审查
驳回拉取请求上的指定审查。
注意
要驳回 受保护分支 上的拉取请求审查,您必须是存储库管理员或包含在可以驳回拉取请求审查的人员或团队列表中。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
“驳回拉取请求审查”的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(写入)
“驳回拉取请求审查”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
名称、类型、描述 |
---|
message 字符串 必填拉取请求审查驳回的消息 |
event 字符串值: |
“驳回拉取请求审查”的HTTP响应状态码
状态代码 | 描述 |
---|---|
200 | OK |
404 | 资源未找到 |
422 | 验证失败,或端点已被滥用。 |
“驳回拉取请求审查”的代码示例
请求示例
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID/dismissals \ -d '{"message":"You are dismissed","event":"DISMISS"}'
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "Here is the body for the review.", "state": "DISMISSED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }
提交拉取请求审查
提交拉取请求的待处理审查。有关为拉取请求创建待处理审查的更多信息,请参阅“为拉取请求创建审查”。
此端点支持以下自定义媒体类型。有关更多信息,请参阅“媒体类型”。
application/vnd.github-commitcomment.raw+json
:返回原始 Markdown 正文。响应将包含body
。如果您未传递任何特定媒体类型,则这是默认值。application/vnd.github-commitcomment.text+json
:返回 Markdown 正文的纯文本表示形式。响应将包含body_text
。application/vnd.github-commitcomment.html+json
:返回从正文的 Markdown 渲染的 HTML。响应将包含body_html
。application/vnd.github-commitcomment.full+json
:返回原始、文本和 HTML 表示形式。响应将包含body
、body_text
和body_html
。
“提交拉取请求审查”的细粒度访问令牌
此端点与以下细粒度令牌类型配合使用:
细粒度令牌必须具有以下权限集
- “拉取请求”代码库权限(写入)
“提交拉取请求审查”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必需代码库的帐户所有者。名称不区分大小写。 |
repo 字符串 必需代码库的名称,不含 |
pull_number 整数 必需标识拉取请求的数字。 |
review_id 整数 必填审查的唯一标识符。 |
名称、类型、描述 |
---|
body 字符串拉取请求审查的正文文本 |
event 字符串 必填您要执行的审查操作。审查操作包括: 可以是以下之一: |
“提交拉取请求审查”的HTTP响应状态码
状态代码 | 描述 |
---|---|
200 | OK |
403 | Forbidden |
404 | 资源未找到 |
422 | 验证失败,或端点已被滥用。 |
“提交拉取请求审查”的代码示例
请求示例
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER/reviews/REVIEW_ID/events \ -d '{"body":"Here is the body for the review.","event":"REQUEST_CHANGES"}'
响应
状态:200
{ "id": 80, "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "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}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "body": "Here is the body for the review.", "state": "APPROVED", "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", "_links": { "html": { "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" }, "pull_request": { "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" } }, "submitted_at": "2019-11-17T17:43:43Z", "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091", "author_association": "COLLABORATOR" }