这些工作摘要的路径有点复杂...
首先调用作业运行的 REST API:
https://api.github.com/repos/{owner}/{repo}/actions/runs/{runid}/jobs
这将返回一个json负载:
{
"total_count": 1,
"jobs": [
{
"id": 13143160145,
"run_id": 4850518271,
"workflow_name": "test",
"head_branch": "main",
"run_url": "https://api.github.com/repos/{owner}/{repo}/actions/runs/4850518271",
"run_attempt": 1,
"node_id": "CR_kwDOJV3v7c8AAAADD2S1UQ",
"head_sha": "db07f0a8a0eb2104583a4165c86d4da5603c8944",
"url": "https://api.github.com/repos/{owner}/{repo}/actions/jobs/13143160145",
"html_url": "https://github.com/{owner}/{repo}/actions/runs/4850518271/jobs/8643488313",
"status": "completed",
"conclusion": "success",
"created_at": "2023-05-01T10:40:11Z",
"started_at": "2023-05-01T10:40:18Z",
"completed_at": "2023-05-01T10:40:20Z",
"name": "build",
"steps": [
...
现在获取 html_url
并将最后一个 ID 去掉:https://github.com/{owner}/{repo}/actions/runs/4850518271/jobs/**8643488313**
然后使用该 ID 获取 summary_raw
:
https://github.com/{owner}/{repo}/actions/runs/4850518271/jobs/8643488313/summary_raw
这应该返回作业摘要的原始降价。
我不确定那个ID表示什么,因为我在文档中找不到参考。
gh run view --log | grep GITHUB_STEP_SUMMARY
,但需要进行一些清理。本来应该更简单的,因为文档说它已经上传到某个地方了。一个直接的链接会更容易使用。 - Azeemhttps://github.com/owner/repo/actions/runs/6122437571/job/16618189294
。它是job,而不是jobs,在尝试获取摘要时无法正常工作。 - undefined