跳至主要内容
REST API 现在已版本化。 有关更多信息,请参阅“关于 API 版本控制”。

用于工作流运行的 REST API 端点

使用 REST API 与 GitHub Actions 中的工作流运行进行交互。

关于 GitHub Actions 中的工作流运行

您可以使用 REST API 查看、重新运行、取消和查看 GitHub Actions 中工作流运行的日志。工作流运行是您的工作流在预配置事件发生时运行的实例。有关更多信息,请参阅“管理工作流运行”。

从工作流运行中重新运行作业

重新运行工作流运行中的作业及其依赖作业。

OAuth 应用令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“从工作流运行中重新运行作业”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

从工作流程运行中重新运行作业的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

job_id integer 必需

作业的唯一标识符。

主体参数
名称,类型,描述
enable_debug_logging boolean

是否为重新运行启用调试日志记录。

默认: false

“从工作流程运行中重新运行作业”的 HTTP 响应状态代码

状态代码描述
201

已创建

403

禁止

“从工作流程运行中重新运行作业”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/jobs/{job_id}/rerun
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/actions/jobs/JOB_ID/rerun

响应

列出存储库的工作流程运行

列出存储库的所有工作流程运行。您可以使用参数缩小结果列表。有关使用参数的更多信息,请参阅参数

任何具有存储库读取权限的人都可以使用此端点。

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

当使用以下参数时,此 API 将为每次搜索返回最多 1,000 个结果:actorbranchcheck_suite_idcreatedeventhead_shastatus

“列出存储库的工作流程运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出仓库工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

查询参数
名称,类型,描述
actor 字符串

返回某人的工作流运行。使用创建与检查套件或工作流运行相关的push的用户登录名。

branch 字符串

返回与分支相关联的工作流运行。使用push的分支名称。

event 字符串

返回由您指定的事件触发的运行。例如,pushpull_requestissue。有关更多信息,请参阅“触发工作流的事件”。

status 字符串

返回具有您指定的检查运行statusconclusion的工作流运行。例如,结论可以是success,状态可以是in_progress。只有 GitHub Actions 可以设置waitingpendingrequested的状态。

可以是以下之一: completed, action_required, cancelled, failure, neutral, skipped, stale, success, timed_out, in_progress, queued, requested, waiting, pending

per_page 整数

每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。

默认: 30

page 整数

要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。

默认: 1

created 字符串

返回在给定日期时间范围内创建的工作流运行。有关语法的更多信息,请参阅“了解搜索语法”。

exclude_pull_requests 布尔值

如果为true,则从响应中省略拉取请求(空数组)。

默认: false

check_suite_id 整数

返回具有您指定的check_suite_id的工作流运行。

head_sha 字符串

仅返回与指定的head_sha相关联的工作流运行。

仓库工作流运行列表的 HTTP 响应状态码

状态代码描述
200

OK

“列出仓库工作流运行”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs
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/actions/runs

响应

状态:200
{ "total_count": 1, "workflow_runs": [ { "id": 30433642, "name": "Build", "node_id": "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ==", "check_suite_id": 42, "check_suite_node_id": "MDEwOkNoZWNrU3VpdGU0Mg==", "head_branch": "master", "head_sha": "acb5820ced9479c074f688cc328bf03f341a511d", "path": ".github/workflows/build.yml@main", "run_number": 562, "event": "push", "display_title": "Update README.md", "status": "queued", "conclusion": null, "workflow_id": 159038, "url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642", "html_url": "https://github.com/octo-org/octo-repo/actions/runs/30433642", "pull_requests": [], "created_at": "2020-01-22T19:33:08Z", "updated_at": "2020-01-22T19:33:08Z", "actor": { "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 }, "run_attempt": 1, "run_started_at": "2020-01-22T19:33:08Z", "triggering_actor": { "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 }, "jobs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs", "logs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs", "check_suite_url": "https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374", "artifacts_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts", "cancel_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel", "rerun_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun", "workflow_url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038", "head_commit": { "id": "acb5820ced9479c074f688cc328bf03f341a511d", "tree_id": "d23f6eedb1e1b9610bbc754ddb5197bfe7271223", "message": "Create linter.yaml", "timestamp": "2020-01-22T19:33:05Z", "author": { "name": "Octo Cat", "email": "[email protected]" }, "committer": { "name": "GitHub", "email": "[email protected]" } }, "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "[email protected]:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks" }, "head_repository": { "id": 217723378, "node_id": "MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg=", "name": "octo-repo", "full_name": "octo-org/octo-repo", "private": true, "owner": { "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 }, "html_url": "https://github.com/octo-org/octo-repo", "description": null, "fork": false, "url": "https://api.github.com/repos/octo-org/octo-repo", "forks_url": "https://api.github.com/repos/octo-org/octo-repo/forks", "keys_url": "https://api.github.com/repos/octo-org/octo-repo/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/octo-org/octo-repo/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/octo-org/octo-repo/teams", "hooks_url": "https://api.github.com/repos/octo-org/octo-repo/hooks", "issue_events_url": "https://api.github.com/repos/octo-org/octo-repo/issues/events{/number}", "events_url": "https://api.github.com/repos/octo-org/octo-repo/events", "assignees_url": "https://api.github.com/repos/octo-org/octo-repo/assignees{/user}", "branches_url": "https://api.github.com/repos/octo-org/octo-repo/branches{/branch}", "tags_url": "https://api.github.com/repos/octo-org/octo-repo/tags", "blobs_url": "https://api.github.com/repos/octo-org/octo-repo/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/octo-org/octo-repo/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/octo-org/octo-repo/git/refs{/sha}", "trees_url": "https://api.github.com/repos/octo-org/octo-repo/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/octo-org/octo-repo/statuses/{sha}", "languages_url": "https://api.github.com/repos/octo-org/octo-repo/languages", "stargazers_url": "https://api.github.com/repos/octo-org/octo-repo/stargazers", "contributors_url": "https://api.github.com/repos/octo-org/octo-repo/contributors", "subscribers_url": "https://api.github.com/repos/octo-org/octo-repo/subscribers", "subscription_url": "https://api.github.com/repos/octo-org/octo-repo/subscription", "commits_url": "https://api.github.com/repos/octo-org/octo-repo/commits{/sha}", "git_commits_url": "https://api.github.com/repos/octo-org/octo-repo/git/commits{/sha}", "comments_url": "https://api.github.com/repos/octo-org/octo-repo/comments{/number}", "issue_comment_url": "https://api.github.com/repos/octo-org/octo-repo/issues/comments{/number}", "contents_url": "https://api.github.com/repos/octo-org/octo-repo/contents/{+path}", "compare_url": "https://api.github.com/repos/octo-org/octo-repo/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/octo-org/octo-repo/merges", "archive_url": "https://api.github.com/repos/octo-org/octo-repo/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/octo-org/octo-repo/downloads", "issues_url": "https://api.github.com/repos/octo-org/octo-repo/issues{/number}", "pulls_url": "https://api.github.com/repos/octo-org/octo-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/octo-org/octo-repo/milestones{/number}", "notifications_url": "https://api.github.com/repos/octo-org/octo-repo/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/octo-org/octo-repo/labels{/name}", "releases_url": "https://api.github.com/repos/octo-org/octo-repo/releases{/id}", "deployments_url": "https://api.github.com/repos/octo-org/octo-repo/deployments" } } ] }

获取工作流运行

获取特定工作流运行。

任何具有存储库读取权限的人都可以使用此端点。

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

“获取工作流运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“获取工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

查询参数
名称,类型,描述
exclude_pull_requests 布尔值

如果为true,则从响应中省略拉取请求(空数组)。

默认: false

“获取工作流运行”的 HTTP 响应状态码

状态代码描述
200

OK

“获取工作流运行”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs/{run_id}
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/actions/runs/RUN_ID

响应

状态:200
{ "id": 30433642, "name": "Build", "node_id": "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ==", "check_suite_id": 42, "check_suite_node_id": "MDEwOkNoZWNrU3VpdGU0Mg==", "head_branch": "main", "head_sha": "acb5820ced9479c074f688cc328bf03f341a511d", "path": ".github/workflows/build.yml@main", "run_number": 562, "event": "push", "display_title": "Update README.md", "status": "queued", "conclusion": null, "workflow_id": 159038, "url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642", "html_url": "https://github.com/octo-org/octo-repo/actions/runs/30433642", "pull_requests": [], "created_at": "2020-01-22T19:33:08Z", "updated_at": "2020-01-22T19:33:08Z", "actor": { "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 }, "run_attempt": 1, "referenced_workflows": [ { "path": "octocat/Hello-World/.github/workflows/deploy.yml@main", "sha": "86e8bc9ecf7d38b1ed2d2cfb8eb87ba9b35b01db", "ref": "refs/heads/main" }, { "path": "octo-org/octo-repo/.github/workflows/report.yml@v2", "sha": "79e9790903e1c3373b1a3e3a941d57405478a232", "ref": "refs/tags/v2" }, { "path": "octo-org/octo-repo/.github/workflows/secure.yml@1595d4b6de6a9e9751fb270a41019ce507d4099e", "sha": "1595d4b6de6a9e9751fb270a41019ce507d4099e" } ], "run_started_at": "2020-01-22T19:33:08Z", "triggering_actor": { "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 }, "jobs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs", "logs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs", "check_suite_url": "https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374", "artifacts_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts", "cancel_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel", "rerun_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun", "previous_attempt_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/attempts/1", "workflow_url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038", "head_commit": { "id": "acb5820ced9479c074f688cc328bf03f341a511d", "tree_id": "d23f6eedb1e1b9610bbc754ddb5197bfe7271223", "message": "Create linter.yaml", "timestamp": "2020-01-22T19:33:05Z", "author": { "name": "Octo Cat", "email": "[email protected]" }, "committer": { "name": "GitHub", "email": "[email protected]" } }, "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "[email protected]:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks" }, "head_repository": { "id": 217723378, "node_id": "MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg=", "name": "octo-repo", "full_name": "octo-org/octo-repo", "private": true, "owner": { "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 }, "html_url": "https://github.com/octo-org/octo-repo", "description": null, "fork": false, "url": "https://api.github.com/repos/octo-org/octo-repo", "forks_url": "https://api.github.com/repos/octo-org/octo-repo/forks", "keys_url": "https://api.github.com/repos/octo-org/octo-repo/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/octo-org/octo-repo/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/octo-org/octo-repo/teams", "hooks_url": "https://api.github.com/repos/octo-org/octo-repo/hooks", "issue_events_url": "https://api.github.com/repos/octo-org/octo-repo/issues/events{/number}", "events_url": "https://api.github.com/repos/octo-org/octo-repo/events", "assignees_url": "https://api.github.com/repos/octo-org/octo-repo/assignees{/user}", "branches_url": "https://api.github.com/repos/octo-org/octo-repo/branches{/branch}", "tags_url": "https://api.github.com/repos/octo-org/octo-repo/tags", "blobs_url": "https://api.github.com/repos/octo-org/octo-repo/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/octo-org/octo-repo/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/octo-org/octo-repo/git/refs{/sha}", "trees_url": "https://api.github.com/repos/octo-org/octo-repo/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/octo-org/octo-repo/statuses/{sha}", "languages_url": "https://api.github.com/repos/octo-org/octo-repo/languages", "stargazers_url": "https://api.github.com/repos/octo-org/octo-repo/stargazers", "contributors_url": "https://api.github.com/repos/octo-org/octo-repo/contributors", "subscribers_url": "https://api.github.com/repos/octo-org/octo-repo/subscribers", "subscription_url": "https://api.github.com/repos/octo-org/octo-repo/subscription", "commits_url": "https://api.github.com/repos/octo-org/octo-repo/commits{/sha}", "git_commits_url": "https://api.github.com/repos/octo-org/octo-repo/git/commits{/sha}", "comments_url": "https://api.github.com/repos/octo-org/octo-repo/comments{/number}", "issue_comment_url": "https://api.github.com/repos/octo-org/octo-repo/issues/comments{/number}", "contents_url": "https://api.github.com/repos/octo-org/octo-repo/contents/{+path}", "compare_url": "https://api.github.com/repos/octo-org/octo-repo/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/octo-org/octo-repo/merges", "archive_url": "https://api.github.com/repos/octo-org/octo-repo/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/octo-org/octo-repo/downloads", "issues_url": "https://api.github.com/repos/octo-org/octo-repo/issues{/number}", "pulls_url": "https://api.github.com/repos/octo-org/octo-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/octo-org/octo-repo/milestones{/number}", "notifications_url": "https://api.github.com/repos/octo-org/octo-repo/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/octo-org/octo-repo/labels{/name}", "releases_url": "https://api.github.com/repos/octo-org/octo-repo/releases{/id}", "deployments_url": "https://api.github.com/repos/octo-org/octo-repo/deployments" } }

删除工作流运行

删除特定工作流运行。

任何对仓库有写入权限的用户都可以使用此端点。

如果仓库是私有的,OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

“删除工作流运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

“删除工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“删除工作流运行”的 HTTP 响应状态码

状态代码描述
204

无内容

“删除工作流运行”的代码示例

请求示例

delete/repos/{owner}/{repo}/actions/runs/{run_id}
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/actions/runs/RUN_ID

响应

状态:204

获取工作流运行的审查历史记录

任何具有存储库读取权限的人都可以使用此端点。

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

“获取工作流运行的审查历史记录”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“获取工作流运行的审查历史记录”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“获取工作流运行的审查历史记录”的 HTTP 响应状态码

状态代码描述
200

OK

“获取工作流运行的审查历史记录”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs/{run_id}/approvals
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/actions/runs/RUN_ID/approvals

响应

状态:200
[ { "state": "approved", "comment": "Ship it!", "environments": [ { "id": 161088068, "node_id": "MDExOkVudmlyb25tZW50MTYxMDg4MDY4", "name": "staging", "url": "https://api.github.com/repos/github/hello-world/environments/staging", "html_url": "https://github.com/github/hello-world/deployments/activity_log?environments_filter=staging", "created_at": "2020-11-23T22:00:40Z", "updated_at": "2020-11-23T22:00:40Z" } ], "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 } } ]

批准分支请求的工作流运行

批准来自首次贡献者的公共分支的拉取请求的工作流运行。有关更多信息,请参阅 "批准来自公共分支的工作流运行."

OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“批准分支请求的工作流运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

用于“批准分支请求的工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

用于“批准分支请求的工作流运行”的 HTTP 响应状态代码

状态代码描述
201

已创建

403

禁止

404

资源未找到

用于“批准分支请求的工作流运行”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/approve
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/actions/runs/RUN_ID/approve

响应

获取工作流运行尝试

获取特定工作流运行尝试。

任何具有存储库读取权限的人都可以使用此端点。

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

用于“获取工作流运行尝试”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

用于“获取工作流运行尝试”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

attempt_number integer 必需

工作流运行的尝试次数。

查询参数
名称,类型,描述
exclude_pull_requests 布尔值

如果为true,则从响应中省略拉取请求(空数组)。

默认: false

用于“获取工作流运行尝试”的 HTTP 响应状态代码

状态代码描述
200

OK

用于“获取工作流运行尝试”的代码示例

请求示例

获取/repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}
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/actions/runs/RUN_ID/attempts/ATTEMPT_NUMBER

响应

状态:200
{ "id": 30433642, "name": "Build", "node_id": "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ==", "check_suite_id": 42, "check_suite_node_id": "MDEwOkNoZWNrU3VpdGU0Mg==", "head_branch": "main", "head_sha": "acb5820ced9479c074f688cc328bf03f341a511d", "path": ".github/workflows/build.yml@main", "run_number": 562, "event": "push", "display_title": "Update README.md", "status": "queued", "conclusion": null, "workflow_id": 159038, "url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642", "html_url": "https://github.com/octo-org/octo-repo/actions/runs/30433642", "pull_requests": [], "created_at": "2020-01-22T19:33:08Z", "updated_at": "2020-01-22T19:33:08Z", "actor": { "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 }, "run_attempt": 1, "referenced_workflows": [ { "path": "octocat/Hello-World/.github/workflows/deploy.yml@main", "sha": "86e8bc9ecf7d38b1ed2d2cfb8eb87ba9b35b01db", "ref": "refs/heads/main" }, { "path": "octo-org/octo-repo/.github/workflows/report.yml@v2", "sha": "79e9790903e1c3373b1a3e3a941d57405478a232", "ref": "refs/tags/v2" }, { "path": "octo-org/octo-repo/.github/workflows/secure.yml@1595d4b6de6a9e9751fb270a41019ce507d4099e", "sha": "1595d4b6de6a9e9751fb270a41019ce507d4099e" } ], "run_started_at": "2020-01-22T19:33:08Z", "triggering_actor": { "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 }, "jobs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs", "logs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs", "check_suite_url": "https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374", "artifacts_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts", "cancel_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel", "rerun_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun", "previous_attempt_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/attempts/1", "workflow_url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038", "head_commit": { "id": "acb5820ced9479c074f688cc328bf03f341a511d", "tree_id": "d23f6eedb1e1b9610bbc754ddb5197bfe7271223", "message": "Create linter.yaml", "timestamp": "2020-01-22T19:33:05Z", "author": { "name": "Octo Cat", "email": "[email protected]" }, "committer": { "name": "GitHub", "email": "[email protected]" } }, "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "[email protected]:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks" }, "head_repository": { "id": 217723378, "node_id": "MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg=", "name": "octo-repo", "full_name": "octo-org/octo-repo", "private": true, "owner": { "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 }, "html_url": "https://github.com/octo-org/octo-repo", "description": null, "fork": false, "url": "https://api.github.com/repos/octo-org/octo-repo", "forks_url": "https://api.github.com/repos/octo-org/octo-repo/forks", "keys_url": "https://api.github.com/repos/octo-org/octo-repo/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/octo-org/octo-repo/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/octo-org/octo-repo/teams", "hooks_url": "https://api.github.com/repos/octo-org/octo-repo/hooks", "issue_events_url": "https://api.github.com/repos/octo-org/octo-repo/issues/events{/number}", "events_url": "https://api.github.com/repos/octo-org/octo-repo/events", "assignees_url": "https://api.github.com/repos/octo-org/octo-repo/assignees{/user}", "branches_url": "https://api.github.com/repos/octo-org/octo-repo/branches{/branch}", "tags_url": "https://api.github.com/repos/octo-org/octo-repo/tags", "blobs_url": "https://api.github.com/repos/octo-org/octo-repo/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/octo-org/octo-repo/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/octo-org/octo-repo/git/refs{/sha}", "trees_url": "https://api.github.com/repos/octo-org/octo-repo/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/octo-org/octo-repo/statuses/{sha}", "languages_url": "https://api.github.com/repos/octo-org/octo-repo/languages", "stargazers_url": "https://api.github.com/repos/octo-org/octo-repo/stargazers", "contributors_url": "https://api.github.com/repos/octo-org/octo-repo/contributors", "subscribers_url": "https://api.github.com/repos/octo-org/octo-repo/subscribers", "subscription_url": "https://api.github.com/repos/octo-org/octo-repo/subscription", "commits_url": "https://api.github.com/repos/octo-org/octo-repo/commits{/sha}", "git_commits_url": "https://api.github.com/repos/octo-org/octo-repo/git/commits{/sha}", "comments_url": "https://api.github.com/repos/octo-org/octo-repo/comments{/number}", "issue_comment_url": "https://api.github.com/repos/octo-org/octo-repo/issues/comments{/number}", "contents_url": "https://api.github.com/repos/octo-org/octo-repo/contents/{+path}", "compare_url": "https://api.github.com/repos/octo-org/octo-repo/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/octo-org/octo-repo/merges", "archive_url": "https://api.github.com/repos/octo-org/octo-repo/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/octo-org/octo-repo/downloads", "issues_url": "https://api.github.com/repos/octo-org/octo-repo/issues{/number}", "pulls_url": "https://api.github.com/repos/octo-org/octo-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/octo-org/octo-repo/milestones{/number}", "notifications_url": "https://api.github.com/repos/octo-org/octo-repo/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/octo-org/octo-repo/labels{/name}", "releases_url": "https://api.github.com/repos/octo-org/octo-repo/releases{/id}", "deployments_url": "https://api.github.com/repos/octo-org/octo-repo/deployments" } }

下载工作流运行尝试日志

获取一个重定向 URL,用于下载特定工作流运行尝试的日志文件存档。此链接在 1 分钟后过期。在响应头中查找 Location: 以找到下载的 URL。

任何具有存储库读取权限的人都可以使用此端点。

如果仓库是私有的,OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“下载工作流运行尝试日志”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“下载工作流运行尝试日志”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

attempt_number integer 必需

工作流运行的尝试次数。

“下载工作流运行尝试日志”的 HTTP 响应状态代码

状态代码描述
302

已找到

“下载工作流运行尝试日志”的代码示例

请求示例

获取/repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs
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/actions/runs/RUN_ID/attempts/ATTEMPT_NUMBER/logs

响应

状态:302

取消工作流运行

使用其 id 取消工作流运行。

OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“取消工作流运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

“取消工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“取消工作流运行”的 HTTP 响应状态代码

状态代码描述
202

已接受

409

冲突

“取消工作流运行”的代码示例

请求示例

发布/repos/{owner}/{repo}/actions/runs/{run_id}/cancel
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/actions/runs/RUN_ID/cancel

响应

查看工作流运行的自定义部署保护规则

批准或拒绝 GitHub 应用程序为工作流运行提供的自定义部署保护规则。有关更多信息,请参阅“使用环境进行部署”。

注意:GitHub 应用程序只能查看其自己的自定义部署保护规则。要批准或拒绝等待特定人员或团队审查的待处理部署,请参阅 POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

用于“查看工作流运行的自定义部署保护规则”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “部署”存储库权限(写入)

“查看工作流运行的自定义部署保护规则”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“查看工作流运行的自定义部署保护规则”的 HTTP 响应状态代码

状态代码描述
204

无内容

“查看工作流运行的自定义部署保护规则”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule
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/actions/runs/RUN_ID/deployment_protection_rule \ -d '{"environment_name":"prod-eus","state":"approved","comment":"All health checks passed."}'

响应

状态:204

强制取消工作流运行

取消工作流运行并绕过会导致工作流执行继续的条件,例如作业上的always()条件。您应该仅在工作流运行未响应POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel时使用此端点来取消工作流运行。

OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“强制取消工作流运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

用于“强制取消工作流运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

用于“强制取消工作流运行”的 HTTP 响应状态代码

状态代码描述
202

已接受

409

冲突

用于“强制取消工作流运行”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel
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/actions/runs/RUN_ID/force-cancel

响应

下载工作流运行日志

获取一个重定向 URL,用于下载工作流运行的日志文件存档。此链接在 1 分钟后过期。在响应头中查找Location:以找到下载的 URL。

任何具有存储库读取权限的人都可以使用此端点。

如果仓库是私有的,OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“下载工作流运行日志”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

用于“下载工作流运行日志”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

用于“下载工作流运行日志”的 HTTP 响应状态代码

状态代码描述
302

已找到

用于“下载工作流运行日志”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs/{run_id}/logs
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/actions/runs/RUN_ID/logs

响应

状态:302

删除工作流运行日志

删除工作流运行的所有日志。

OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

用于“删除工作流运行日志”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

用于“删除工作流运行日志”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

用于“删除工作流运行日志”的 HTTP 响应状态代码

状态代码描述
204

无内容

403

禁止

500

内部错误

用于“删除工作流运行日志”的代码示例

请求示例

delete/repos/{owner}/{repo}/actions/runs/{run_id}/logs
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/actions/runs/RUN_ID/logs

响应

状态:204

获取工作流运行的待处理部署

获取工作流运行中所有等待保护规则通过的部署环境。

任何具有存储库读取权限的人都可以使用此端点。

如果仓库是私有的,OAuth 令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

“获取工作流运行的待处理部署”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“获取工作流运行的待处理部署”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“获取工作流运行的待处理部署”的 HTTP 响应状态码

状态代码描述
200

OK

“获取工作流运行的待处理部署”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments
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/actions/runs/RUN_ID/pending_deployments

响应

状态:200
[ { "environment": { "id": 161088068, "node_id": "MDExOkVudmlyb25tZW50MTYxMDg4MDY4", "name": "staging", "url": "https://api.github.com/repos/github/hello-world/environments/staging", "html_url": "https://github.com/github/hello-world/deployments/activity_log?environments_filter=staging" }, "wait_timer": 30, "wait_timer_started_at": "2020-11-23T22:00:40Z", "current_user_can_approve": true, "reviewers": [ { "type": "User", "reviewer": { "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 } }, { "type": "Team", "reviewer": { "id": 1, "node_id": "MDQ6VGVhbTE=", "url": "https://api.github.com/teams/1", "html_url": "https://github.com/orgs/github/teams/justice-league", "name": "Justice League", "slug": "justice-league", "description": "A great team.", "privacy": "closed", "notification_setting": "notifications_enabled", "permission": "admin", "members_url": "https://api.github.com/teams/1/members{/member}", "repositories_url": "https://api.github.com/teams/1/repos", "parent": null } } ] } ]

审查工作流运行的待处理部署

批准或拒绝等待必需审阅者批准的待处理部署。

具有仓库内容和部署读取权限的必需审阅者可以使用此端点。

OAuth 应用令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

“审查工作流运行的待处理部署”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • "Actions" 仓库权限 (读取)"Checks" 仓库权限 (读取)"Deployments" 仓库权限 (读取)

“审查工作流运行的待定部署”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

主体参数
名称,类型,描述
environment_ids 整数数组 必需

要批准或拒绝的 环境 ID 列表。

state 字符串 必需

是否批准或拒绝部署到指定的 环境。

可以是以下之一: approved, rejected

comment 字符串 必需

与部署审查相关的评论。

“审查工作流运行的待定部署”的 HTTP 响应状态代码

状态代码描述
200

OK

“审查工作流运行的待定部署”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments
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/actions/runs/RUN_ID/pending_deployments \ -d '{"environment_ids":[161171787],"state":"approved","comment":"Ship it!"}'

响应

状态:200
[ { "url": "https://api.github.com/repos/octocat/example/deployments/1", "id": 1, "node_id": "MDEwOkRlcGxveW1lbnQx", "sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", "ref": "topic-branch", "task": "deploy", "payload": {}, "original_environment": "staging", "environment": "production", "description": "Deploy request from hubot", "creator": { "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 }, "created_at": "2012-07-20T01:19:13Z", "updated_at": "2012-07-20T01:19:13Z", "statuses_url": "https://api.github.com/repos/octocat/example/deployments/1/statuses", "repository_url": "https://api.github.com/repos/octocat/example", "transient_environment": false, "production_environment": true } ]

重新运行工作流

使用工作流运行的 id 重新运行工作流运行。

OAuth 应用令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

“重新运行工作流”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

“重新运行工作流”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

主体参数
名称,类型,描述
enable_debug_logging boolean

是否为重新运行启用调试日志记录。

默认: false

“重新运行工作流”的 HTTP 响应状态代码

状态代码描述
201

已创建

“重新运行工作流”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/rerun
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/actions/runs/RUN_ID/rerun

响应

重新运行工作流运行中的失败作业

使用工作流运行的 id 重新运行工作流运行中的所有失败作业及其依赖作业。

OAuth 应用令牌和个人访问令牌(经典)需要 repo 范围才能使用此端点。

“重新运行工作流运行中的失败作业”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “Actions” 存储库权限(写入)

“重新运行工作流运行中的失败作业”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

主体参数
名称,类型,描述
enable_debug_logging boolean

是否为重新运行启用调试日志记录。

默认: false

“重新运行工作流运行中的失败作业”的 HTTP 响应状态码

状态代码描述
201

已创建

“重新运行工作流运行中的失败作业”的代码示例

请求示例

post/repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs
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/actions/runs/RUN_ID/rerun-failed-jobs

响应

获取工作流运行使用情况

获取特定工作流运行的可计费分钟数和总运行时间。可计费分钟数仅适用于使用 GitHub 托管运行器的私有存储库中的工作流。使用情况按每个 GitHub 托管运行器操作系统以毫秒为单位列出。任何作业重新运行也包含在使用情况中。使用情况不包括 macOS 和 Windows 运行器的乘数,并且不会四舍五入到最接近的整分钟。有关更多信息,请参阅“管理 GitHub Actions 的计费”。

任何具有存储库读取权限的人都可以使用此端点。

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

“获取工作流运行使用情况”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“获取工作流运行使用情况”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

run_id 整数 必需

工作流运行的唯一标识符。

“获取工作流运行使用情况”的 HTTP 响应状态码

状态代码描述
200

OK

“获取工作流运行使用情况”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/runs/{run_id}/timing
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/actions/runs/RUN_ID/timing

响应

状态:200
{ "billable": { "UBUNTU": { "total_ms": 180000, "jobs": 1, "job_runs": [ { "job_id": 1, "duration_ms": 180000 } ] }, "MACOS": { "total_ms": 240000, "jobs": 4, "job_runs": [ { "job_id": 2, "duration_ms": 60000 }, { "job_id": 3, "duration_ms": 60000 }, { "job_id": 4, "duration_ms": 60000 }, { "job_id": 5, "duration_ms": 60000 } ] }, "WINDOWS": { "total_ms": 300000, "jobs": 2, "job_runs": [ { "job_id": 6, "duration_ms": 150000 }, { "job_id": 7, "duration_ms": 150000 } ] } }, "run_duration_ms": 500000 }

列出工作流的运行

列出工作流的所有运行。您可以将 workflow_id 替换为工作流文件名。例如,您可以使用 main.yaml。您可以使用参数来缩小结果列表。有关使用参数的更多信息,请参阅 参数

任何具有存储库读取权限的用户都可以使用此端点

OAuth 应用程序令牌和个人访问令牌(经典)需要repo范围才能将此端点与私有存储库一起使用。

针对“列出工作流的运行”的细粒度访问令牌

此端点与以下细粒度令牌类型一起使用

细粒度令牌必须具有以下权限集

  • “操作”存储库权限(读取)

如果仅请求公共资源,则无需身份验证或上述权限即可使用此端点。

“列出工作流的运行”的参数

标题
名称,类型,描述
accept string

建议设置为application/vnd.github+json

路径参数
名称,类型,描述
owner string 必需

存储库的帐户所有者。名称不区分大小写。

repo string 必需

存储库的名称,不包含.git扩展名。名称不区分大小写。

workflow_id 必填

工作流的 ID。您也可以将工作流文件名作为字符串传递。

查询参数
名称,类型,描述
actor 字符串

返回某人的工作流运行。使用创建与检查套件或工作流运行相关的push的用户登录名。

branch 字符串

返回与分支相关联的工作流运行。使用push的分支名称。

event 字符串

返回由您指定的事件触发的运行。例如,pushpull_requestissue。有关更多信息,请参阅“触发工作流的事件”。

status 字符串

返回具有您指定的检查运行statusconclusion的工作流运行。例如,结论可以是success,状态可以是in_progress。只有 GitHub Actions 可以设置waitingpendingrequested的状态。

可以是以下之一: completed, action_required, cancelled, failure, neutral, skipped, stale, success, timed_out, in_progress, queued, requested, waiting, pending

per_page 整数

每页结果数(最大 100)。有关更多信息,请参阅“在 REST API 中使用分页”。

默认: 30

page 整数

要获取的结果的页码。有关更多信息,请参阅“在 REST API 中使用分页”。

默认: 1

created 字符串

返回在给定日期时间范围内创建的工作流运行。有关语法的更多信息,请参阅“了解搜索语法”。

exclude_pull_requests 布尔值

如果为true,则从响应中省略拉取请求(空数组)。

默认: false

check_suite_id 整数

返回具有您指定的check_suite_id的工作流运行。

head_sha 字符串

仅返回与指定的head_sha相关联的工作流运行。

“列出工作流的运行”的 HTTP 响应状态码

状态代码描述
200

OK

“列出工作流的运行”的代码示例

请求示例

get/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs
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/actions/workflows/WORKFLOW_ID/runs

响应

状态:200
{ "total_count": 1, "workflow_runs": [ { "id": 30433642, "name": "Build", "node_id": "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ==", "check_suite_id": 42, "check_suite_node_id": "MDEwOkNoZWNrU3VpdGU0Mg==", "head_branch": "master", "head_sha": "acb5820ced9479c074f688cc328bf03f341a511d", "path": ".github/workflows/build.yml@main", "run_number": 562, "event": "push", "display_title": "Update README.md", "status": "queued", "conclusion": null, "workflow_id": 159038, "url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642", "html_url": "https://github.com/octo-org/octo-repo/actions/runs/30433642", "pull_requests": [], "created_at": "2020-01-22T19:33:08Z", "updated_at": "2020-01-22T19:33:08Z", "actor": { "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 }, "run_attempt": 1, "run_started_at": "2020-01-22T19:33:08Z", "triggering_actor": { "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 }, "jobs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs", "logs_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs", "check_suite_url": "https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374", "artifacts_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts", "cancel_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel", "rerun_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun", "workflow_url": "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038", "head_commit": { "id": "acb5820ced9479c074f688cc328bf03f341a511d", "tree_id": "d23f6eedb1e1b9610bbc754ddb5197bfe7271223", "message": "Create linter.yaml", "timestamp": "2020-01-22T19:33:05Z", "author": { "name": "Octo Cat", "email": "[email protected]" }, "committer": { "name": "GitHub", "email": "[email protected]" } }, "repository": { "id": 1296269, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World", "owner": { "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 }, "private": false, "html_url": "https://github.com/octocat/Hello-World", "description": "This your first repo!", "fork": false, "url": "https://api.github.com/repos/octocat/Hello-World", "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", "events_url": "https://api.github.com/repos/octocat/Hello-World/events", "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", "git_url": "git:github.com/octocat/Hello-World.git", "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", "ssh_url": "[email protected]:octocat/Hello-World.git", "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks" }, "head_repository": { "id": 217723378, "node_id": "MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg=", "name": "octo-repo", "full_name": "octo-org/octo-repo", "private": true, "owner": { "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 }, "html_url": "https://github.com/octo-org/octo-repo", "description": null, "fork": false, "url": "https://api.github.com/repos/octo-org/octo-repo", "forks_url": "https://api.github.com/repos/octo-org/octo-repo/forks", "keys_url": "https://api.github.com/repos/octo-org/octo-repo/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/octo-org/octo-repo/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/octo-org/octo-repo/teams", "hooks_url": "https://api.github.com/repos/octo-org/octo-repo/hooks", "issue_events_url": "https://api.github.com/repos/octo-org/octo-repo/issues/events{/number}", "events_url": "https://api.github.com/repos/octo-org/octo-repo/events", "assignees_url": "https://api.github.com/repos/octo-org/octo-repo/assignees{/user}", "branches_url": "https://api.github.com/repos/octo-org/octo-repo/branches{/branch}", "tags_url": "https://api.github.com/repos/octo-org/octo-repo/tags", "blobs_url": "https://api.github.com/repos/octo-org/octo-repo/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/octo-org/octo-repo/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/octo-org/octo-repo/git/refs{/sha}", "trees_url": "https://api.github.com/repos/octo-org/octo-repo/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/octo-org/octo-repo/statuses/{sha}", "languages_url": "https://api.github.com/repos/octo-org/octo-repo/languages", "stargazers_url": "https://api.github.com/repos/octo-org/octo-repo/stargazers", "contributors_url": "https://api.github.com/repos/octo-org/octo-repo/contributors", "subscribers_url": "https://api.github.com/repos/octo-org/octo-repo/subscribers", "subscription_url": "https://api.github.com/repos/octo-org/octo-repo/subscription", "commits_url": "https://api.github.com/repos/octo-org/octo-repo/commits{/sha}", "git_commits_url": "https://api.github.com/repos/octo-org/octo-repo/git/commits{/sha}", "comments_url": "https://api.github.com/repos/octo-org/octo-repo/comments{/number}", "issue_comment_url": "https://api.github.com/repos/octo-org/octo-repo/issues/comments{/number}", "contents_url": "https://api.github.com/repos/octo-org/octo-repo/contents/{+path}", "compare_url": "https://api.github.com/repos/octo-org/octo-repo/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/octo-org/octo-repo/merges", "archive_url": "https://api.github.com/repos/octo-org/octo-repo/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/octo-org/octo-repo/downloads", "issues_url": "https://api.github.com/repos/octo-org/octo-repo/issues{/number}", "pulls_url": "https://api.github.com/repos/octo-org/octo-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/octo-org/octo-repo/milestones{/number}", "notifications_url": "https://api.github.com/repos/octo-org/octo-repo/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/octo-org/octo-repo/labels{/name}", "releases_url": "https://api.github.com/repos/octo-org/octo-repo/releases{/id}", "deployments_url": "https://api.github.com/repos/octo-org/octo-repo/deployments" } } ] }