检查运行的 REST API 端点
使用 REST API 管理检查运行。
注意
与检查交互的 REST API 的写入权限仅对 GitHub 应用可用。OAuth 应用和经过身份验证的用户可以查看检查运行和检查套件,但无法创建它们。如果您没有构建 GitHub 应用,您可能希望使用 REST API 与提交状态交互。
创建检查运行
为仓库中的特定提交创建一个新的检查运行。
要创建检查运行,您必须使用 GitHub 应用。OAuth 应用和经过身份验证的用户无法创建检查套件。
在检查套件中,GitHub 将具有相同名称的检查运行的数量限制为 1000 个。一旦这些检查运行超过 1000 个,GitHub 将开始自动删除较旧的检查运行。
注意
检查 API 仅查找创建检查套件或检查运行的仓库中的推送。对分支的推送不会被检测到,并且会返回一个空的 pull_requests
数组。
“创建检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”仓库权限(写入)
“创建检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
名称、类型、描述 | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name 字符串 必填检查的名称。例如,“代码覆盖率”。 | ||||||||||||||||||||||
head_sha 字符串 必填提交的 SHA。 | ||||||||||||||||||||||
details_url 字符串包含检查完整详细信息的集成程序网站的 URL。如果集成程序未提供此 URL,则使用 GitHub 应用的主页。 | ||||||||||||||||||||||
external_id 字符串集成程序系统上运行的参考。 | ||||||||||||||||||||||
status 字符串检查运行的当前状态。只有 GitHub Actions 可以将状态设置为 默认值: 可以是以下之一: | ||||||||||||||||||||||
started_at 字符串检查运行开始的时间。这是 ISO 8601 格式的时间戳: | ||||||||||||||||||||||
conclusion 字符串如果您提供 可以是以下之一: | ||||||||||||||||||||||
completed_at 字符串检查完成的时间。这是 ISO 8601 格式的时间戳: | ||||||||||||||||||||||
output 对象检查运行可以在 | ||||||||||||||||||||||
|
名称、类型、描述 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
title 字符串 必填检查运行的标题。 | ||||||||||
summary 字符串 必填检查运行的摘要。此参数支持 Markdown。最大长度:65535 个字符。 | ||||||||||
text 字符串检查运行的详细信息。此参数支持 Markdown。最大长度:65535 个字符。 | ||||||||||
|
名称、类型、描述 |
---|
path 字符串 必填要添加注释的文件的路径。例如, |
start_line 整数 必填注释的起始行。行号从 1 开始。 |
end_line 整数 必填注释的结束行。 |
start_column 整数注释的起始列。注释仅支持同一行上的 |
end_column 整数注释的结束列。注释仅支持同一行上的 |
annotation_level 字符串 必填注释的级别。 可以是以下之一: |
message 字符串 必填这些代码行的反馈的简短描述。最大大小为 64 KB。 |
title 字符串表示注释的标题。最大大小为 255 个字符。 |
raw_details 字符串有关此注释的详细信息。最大大小为 64 KB。 |
images
对象数组将图像添加到 GitHub 拉取请求 UI 中显示的输出中。
images
的属性
名称、类型、描述 |
---|
alt 字符串 必填图像的替代文本。 |
image_url 字符串 必填图像的完整 URL。 |
caption 字符串简短的图像描述。 |
actions
对象数组在 GitHub 上显示一个按钮,用户可以点击该按钮以提醒您的应用执行其他任务。例如,代码整理应用可以显示一个按钮,自动修复检测到的错误。在此对象中创建的按钮在检查运行完成后显示。当用户点击按钮时,GitHub 会将 check_run.requested_action
webhook 发送到您的应用。每个操作都包含 label
、identifier
和 description
。最多接受三个操作。要了解有关检查运行和请求操作的更多信息,请参阅“检查运行和请求操作”。
actions
的属性
名称、类型、描述 |
---|
label 字符串 必填要在 Web UI 中按钮上显示的文本。最大大小为 20 个字符。 |
description 字符串 必填对此操作将执行的操作的简短解释。最大大小为 40 个字符。 |
identifier 字符串 必填集成程序系统上操作的参考。最大大小为 20 个字符。 |
“创建检查运行”的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
201 | 已创建 |
“创建检查运行”的代码示例
请求示例
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/check-runs \ -d '{"name":"mighty_readme","head_sha":"ce587453ced02b1526dfb4cb910479d431683101","status":"in_progress","external_id":"42","started_at":"2018-05-04T01:14:52Z","output":{"title":"Mighty Readme report","summary":"","text":""}}'
in_progress 结论的响应
状态:201
{ "id": 4, "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", "node_id": "MDg6Q2hlY2tSdW40", "external_id": "42", "url": "https://api.github.com/repos/github/hello-world/check-runs/4", "html_url": "https://github.com/github/hello-world/runs/4", "details_url": "https://example.com", "status": "in_progress", "conclusion": null, "started_at": "2018-05-04T01:14:52Z", "completed_at": null, "output": { "title": "Mighty Readme report", "summary": "There are 0 failures, 2 warnings, and 1 notice.", "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", "annotations_count": 2, "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations" }, "name": "mighty_readme", "check_suite": { "id": 5 }, "app": { "id": 1, "slug": "octoapp", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "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", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }, "pull_requests": [ { "url": "https://api.github.com/repos/github/hello-world/pulls/1", "id": 1934, "number": 3956, "head": { "ref": "say-hello", "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } }, "base": { "ref": "master", "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } } } ] }
获取检查运行
使用其 id
获取单个检查运行。
注意
检查 API 仅查找创建检查套件或检查运行的仓库中的推送。对分支的推送不会被检测到,并且会返回一个空的 pull_requests
数组。
OAuth 应用令牌和个人访问令牌(经典)需要 repo
范围才能在私有存储库上使用此端点。
“获取检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”存储库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
“获取检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
check_run_id 整数 必填检查运行的唯一标识符。 |
“获取检查运行”的 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/check-runs/CHECK_RUN_ID
回应
状态:200
{ "id": 4, "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", "node_id": "MDg6Q2hlY2tSdW40", "external_id": "", "url": "https://api.github.com/repos/github/hello-world/check-runs/4", "html_url": "https://github.com/github/hello-world/runs/4", "details_url": "https://example.com", "status": "completed", "conclusion": "neutral", "started_at": "2018-05-04T01:14:52Z", "completed_at": "2018-05-04T01:14:52Z", "output": { "title": "Mighty Readme report", "summary": "There are 0 failures, 2 warnings, and 1 notice.", "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", "annotations_count": 2, "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations" }, "name": "mighty_readme", "check_suite": { "id": 5 }, "app": { "id": 1, "slug": "octoapp", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "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", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }, "pull_requests": [ { "url": "https://api.github.com/repos/github/hello-world/pulls/1", "id": 1934, "number": 3956, "head": { "ref": "say-hello", "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } }, "base": { "ref": "master", "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } } } ] }
更新检查运行
更新存储库中特定提交的检查运行。
注意
管理检查的端点仅查找创建检查套件或检查运行的存储库中的推送。对派生存储库中分支的推送不会被检测到,并且会返回一个空的 pull_requests
数组。
OAuth 应用和个人访问令牌(经典)无法使用此端点。
“更新检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”仓库权限(写入)
“更新检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
check_run_id 整数 必填检查运行的唯一标识符。 |
名称、类型、描述 | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name 字符串检查的名称。例如,“代码覆盖率”。 | ||||||||||||||||||||||
details_url 字符串具有检查完整详细信息的集成程序站点的 URL。 | ||||||||||||||||||||||
external_id 字符串集成程序系统上运行的参考。 | ||||||||||||||||||||||
started_at 字符串这是 ISO 8601 格式的时间戳: | ||||||||||||||||||||||
status 字符串检查运行的当前状态。只有 GitHub Actions 可以将状态设置为 可以是以下之一: | ||||||||||||||||||||||
conclusion 字符串如果您提供 可以是以下之一: | ||||||||||||||||||||||
completed_at 字符串检查完成的时间。这是 ISO 8601 格式的时间戳: | ||||||||||||||||||||||
output 对象检查运行可以在 | ||||||||||||||||||||||
|
名称、类型、描述 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
title 字符串必填. | ||||||||||
summary 字符串 必填可以包含 Markdown。 | ||||||||||
text 字符串可以包含 Markdown。 | ||||||||||
|
名称、类型、描述 |
---|
path 字符串 必填要添加注释的文件的路径。例如, |
start_line 整数 必填注释的起始行。行号从 1 开始。 |
end_line 整数 必填注释的结束行。 |
start_column 整数注释的起始列。注释仅支持同一行上的 |
end_column 整数注释的结束列。注释仅支持同一行上的 |
annotation_level 字符串 必填注释的级别。 可以是以下之一: |
message 字符串 必填这些代码行的反馈的简短描述。最大大小为 64 KB。 |
title 字符串表示注释的标题。最大大小为 255 个字符。 |
raw_details 字符串有关此注释的详细信息。最大大小为 64 KB。 |
images
对象数组将图像添加到 GitHub 拉取请求 UI 中显示的输出中。
images
的属性
名称、类型、描述 |
---|
alt 字符串 必填图像的替代文本。 |
image_url 字符串 必填图像的完整 URL。 |
caption 字符串简短的图像描述。 |
actions
对象数组集成程序可以执行的可能后续操作,用户可能会触发这些操作。每个操作都包含 label
、identifier
和 description
。最多接受三个操作。要了解有关检查运行和请求操作的更多信息,请参阅“检查运行和请求操作”。
actions
的属性
名称、类型、描述 |
---|
label 字符串 必填要在 Web UI 中按钮上显示的文本。最大大小为 20 个字符。 |
description 字符串 必填对此操作将执行的操作的简短解释。最大大小为 40 个字符。 |
identifier 字符串 必填集成程序系统上操作的参考。最大大小为 20 个字符。 |
“更新检查运行”的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | 确定 |
“更新检查运行”的代码示例
请求示例
curl -L \ -X PATCH \ -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/check-runs/CHECK_RUN_ID \ -d '{"name":"mighty_readme","started_at":"2018-05-04T01:14:52Z","status":"completed","conclusion":"success","completed_at":"2018-05-04T01:14:52Z","output":{"title":"Mighty Readme report","summary":"There are 0 failures, 2 warnings, and 1 notices.","text":"You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.","annotations":[{"path":"README.md","annotation_level":"warning","title":"Spell Checker","message":"Check your spelling for '\''banaas'\''.","raw_details":"Do you mean '\''bananas'\'' or '\''banana'\''?","start_line":2,"end_line":2},{"path":"README.md","annotation_level":"warning","title":"Spell Checker","message":"Check your spelling for '\''aples'\''","raw_details":"Do you mean '\''apples'\'' or '\''Naples'\''","start_line":4,"end_line":4}],"images":[{"alt":"Super bananas","image_url":"http://example.com/images/42"}]}}'
回应
状态:200
{ "id": 4, "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", "node_id": "MDg6Q2hlY2tSdW40", "external_id": "", "url": "https://api.github.com/repos/github/hello-world/check-runs/4", "html_url": "https://github.com/github/hello-world/runs/4", "details_url": "https://example.com", "status": "completed", "conclusion": "neutral", "started_at": "2018-05-04T01:14:52Z", "completed_at": "2018-05-04T01:14:52Z", "output": { "title": "Mighty Readme report", "summary": "There are 0 failures, 2 warnings, and 1 notice.", "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", "annotations_count": 2, "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations" }, "name": "mighty_readme", "check_suite": { "id": 5 }, "app": { "id": 1, "slug": "octoapp", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "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", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }, "pull_requests": [ { "url": "https://api.github.com/repos/github/hello-world/pulls/1", "id": 1934, "number": 3956, "head": { "ref": "say-hello", "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } }, "base": { "ref": "master", "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } } } ] }
列出检查运行注释
使用注释id
列出检查运行的注释。
OAuth 应用令牌和个人访问令牌(经典)需要 repo
范围才能在私有存储库上使用此端点。
“列出检查运行注释”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”存储库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
“列出检查运行注释”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
check_run_id 整数 必填检查运行的唯一标识符。 |
名称、类型、描述 |
---|
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/check-runs/CHECK_RUN_ID/annotations
回应
状态:200
[ { "path": "README.md", "start_line": 2, "end_line": 2, "start_column": 5, "end_column": 10, "annotation_level": "warning", "title": "Spell Checker", "message": "Check your spelling for 'banaas'.", "raw_details": "Do you mean 'bananas' or 'banana'?", "blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc" } ]
重新请求检查运行
触发 GitHub 重新请求现有的检查运行,无需将新代码推送到存储库。此端点将触发带有操作rerequested
的check_run
Webhook事件。当检查运行为rerequested
时,其status
将重置为queued
,并且conclusion
将被清除。
有关如何重新运行 GitHub Actions 作业的更多信息,请参阅“从工作流运行中重新运行作业”。
OAuth 应用和个人访问令牌(经典)无法使用此端点。
“重新请求检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”仓库权限(写入)
“重新请求检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
check_run_id 整数 必填检查运行的唯一标识符。 |
“重新请求检查运行”的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
201 | 已创建 |
403 | 如果检查运行不可重新请求或不属于经过身份验证的 GitHub 应用程序,则禁止访问。 |
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/check-runs/CHECK_RUN_ID/rerequest
回应
列出检查套件中的检查运行
使用其id
列出检查套件的检查运行。
注意
管理检查的端点仅查找创建检查套件或检查运行的存储库中的推送。对派生存储库中分支的推送不会被检测到,并且会返回一个空的 pull_requests
数组。
OAuth 应用令牌和个人访问令牌(经典)需要 repo
范围才能在私有存储库上使用此端点。
“列出检查套件中的检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”存储库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
“列出检查套件中的检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
check_suite_id 整数 必需检查套件的唯一标识符。 |
名称、类型、描述 |
---|
check_name 字符串返回具有指定 |
status 字符串返回具有指定 可以是以下之一: |
filter 字符串按其 默认值: 可以是以下之一: |
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/check-suites/CHECK_SUITE_ID/check-runs
回应
状态:200
{ "total_count": 1, "check_runs": [ { "id": 4, "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", "node_id": "MDg6Q2hlY2tSdW40", "external_id": "", "url": "https://api.github.com/repos/github/hello-world/check-runs/4", "html_url": "https://github.com/github/hello-world/runs/4", "details_url": "https://example.com", "status": "completed", "conclusion": "neutral", "started_at": "2018-05-04T01:14:52Z", "completed_at": "2018-05-04T01:14:52Z", "output": { "title": "Mighty Readme report", "summary": "There are 0 failures, 2 warnings, and 1 notice.", "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", "annotations_count": 2, "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations" }, "name": "mighty_readme", "check_suite": { "id": 5 }, "app": { "id": 1, "slug": "octoapp", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "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", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }, "pull_requests": [ { "url": "https://api.github.com/repos/github/hello-world/pulls/1", "id": 1934, "number": 3956, "head": { "ref": "say-hello", "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } }, "base": { "ref": "master", "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } } } ] } ] }
列出 Git 引用中的检查运行
列出提交引用的检查运行。ref
可以是 SHA、分支名称或标签名称。
注意
管理检查的端点仅查找创建检查套件或检查运行的存储库中的推送。对派生存储库中分支的推送不会被检测到,并且会返回一个空的 pull_requests
数组。
如果单个 Git 引用上超过 1000 个检查套件,则此端点会将检查运行限制为最近的 1000 个检查套件。要迭代所有可能的检查运行,请使用列出 Git 引用中的检查套件端点,并将check_suite_id
参数提供给列出检查套件中的检查运行端点。
OAuth 应用令牌和个人访问令牌(经典)需要 repo
范围才能在私有存储库上使用此端点。
“列出 Git 引用中的检查运行”的细粒度访问令牌
此端点适用于以下细粒度令牌类型:
细粒度令牌必须具有以下权限集
- “检查”存储库权限(读取)
如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。
“列出 Git 引用中的检查运行”的参数
名称、类型、描述 |
---|
accept 字符串建议设置为 |
名称、类型、描述 |
---|
owner 字符串 必填仓库的帐户所有者。名称不区分大小写。 |
repo 字符串 必填不带 |
ref 字符串 必需提交引用。可以是提交 SHA、分支名称( |
名称、类型、描述 |
---|
check_name 字符串返回具有指定 |
status 字符串返回具有指定 可以是以下之一: |
filter 字符串按其 默认值: 可以是以下之一: |
per_page 整数每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
page 整数要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。 默认值: |
app_id 整数 |
“列出 Git 引用中的检查运行”的 HTTP 响应状态代码
状态代码 | 描述 |
---|---|
200 | 确定 |
“列出 Git 引用中的检查运行”的代码示例
请求示例
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/commits/REF/check-runs
回应
状态:200
{ "total_count": 1, "check_runs": [ { "id": 4, "head_sha": "ce587453ced02b1526dfb4cb910479d431683101", "node_id": "MDg6Q2hlY2tSdW40", "external_id": "", "url": "https://api.github.com/repos/github/hello-world/check-runs/4", "html_url": "https://github.com/github/hello-world/runs/4", "details_url": "https://example.com", "status": "completed", "conclusion": "neutral", "started_at": "2018-05-04T01:14:52Z", "completed_at": "2018-05-04T01:14:52Z", "output": { "title": "Mighty Readme report", "summary": "There are 0 failures, 2 warnings, and 1 notice.", "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.", "annotations_count": 2, "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations" }, "name": "mighty_readme", "check_suite": { "id": 5 }, "app": { "id": 1, "slug": "octoapp", "node_id": "MDExOkludGVncmF0aW9uMQ==", "owner": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://api.github.com/orgs/github", "repos_url": "https://api.github.com/orgs/github/repos", "events_url": "https://api.github.com/orgs/github/events", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "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", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": true }, "name": "Octocat App", "description": "", "external_url": "https://example.com", "html_url": "https://github.com/apps/octoapp", "created_at": "2017-07-08T16:18:44-04:00", "updated_at": "2017-07-08T16:18:44-04:00", "permissions": { "metadata": "read", "contents": "read", "issues": "write", "single_file": "write" }, "events": [ "push", "pull_request" ] }, "pull_requests": [ { "url": "https://api.github.com/repos/github/hello-world/pulls/1", "id": 1934, "number": 3956, "head": { "ref": "say-hello", "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } }, "base": { "ref": "master", "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f", "repo": { "id": 526, "url": "https://api.github.com/repos/github/hello-world", "name": "hello-world" } } } ] } ] }