跳转至

列出特定 Run 的 Artifacts

GET /api/v8/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts

用户调用此接口,分页查询指定 Workflow Run 产生的所有制品,支持按创建时间排序。

访问令牌支持说明

  • AtomGit 用户访问令牌(AtomGit user access tokens)

是否允许匿名访问

此接口允许匿名访问

请求参数

参数名 位置 类型 必填 说明
owner path string 是 仓库所属空间地址(组织或个人的地址 path)
repo path string 是 仓库路径(path)
run_id path string 是 流水线运行 id
name query string 否 制品名称过滤(模糊匹配)
sort query string 否 排序字段,当前仅支持 created
direction query string 否 排序方向,asc 或 desc;默认 desc
page query integer 否 当前页码,需为正整数
per_page query integer 否 每页的项目数

响应参数

字段 类型 必返 可为空 说明
total_count integer 是 否 制品总数
artifacts array 是 否 制品列表

artifacts[] 对象

字段 类型 必返 可为空 说明
artifacts[].id string 是 否 制品 ID
artifacts[].name string 是 否 制品名称
artifacts[].size_bytes integer 是 否 制品大小(字节)
artifacts[].workflow_id string 是 否 工作流 ID
artifacts[].workflow_run_id string 是 否 工作流运行 ID
artifacts[].digest string 是 否 SHA256 摘要
artifacts[].expires_at string 是 是 过期时间(ISO 8601 时间格式字符串),可能为空
artifacts[].created_at string 是 是 创建时间(ISO 8601 时间格式字符串),可能为空
artifacts[].updated_at string 是 是 更新时间(ISO 8601 时间格式字符串),可能为空

失败响应

400 参数错误

{
  "error": "bad_request",
  "message": "参数校验失败,page 必须为正整数"
}

401 未认证

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

404 未找到

{
  "error": "not_found",
  "message": "仓库或指定的 Workflow Run 不存在"
}

错误字段名以后端实际返回为准。

HTTP 响应状态码

状态码 说明
200 成功(OK)
400 参数错误(Bad request)
401 需要认证(Requires authentication)
403 禁止访问(Forbidden)
404 资源不存在(Not found)
500 系统内部错误(Internal server error)

请求示例

参数说明

示例中的占位符替换为实际值即可调用;该接口允许匿名访问,也可携带 AtomGit 用户访问令牌。

<owner> 替换为仓库所属空间地址(组织或个人的地址 path);<repo> 替换为仓库路径(path);<run_id> 替换为流水线运行 id。

cURL

curl -X GET 'https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/artifacts?page=1&per_page=10' \
  -H 'Accept: application/json'

JavaScript

const response = await fetch(
  "https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/artifacts?page=1&per_page=10",
  {
    headers: { "Accept": "application/json" },
  }
);

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/artifacts",
    params={"page": 1, "per_page": 10},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

响应示例

状态码: 200

{
  "total_count": 1,
  "artifacts": [
    {
      "id": "0195f4f8-2f3a-7b9e-9c8d-1a2b3c4d5e6f",
      "name": "build-output",
      "size_bytes": 1048576,
      "workflow_id": "12345",
      "workflow_run_id": "67890",
      "digest": "sha256:2c3f4e5a6d7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b",
      "expires_at": "2026-10-14T00:00:00+08:00",
      "created_at": "2026-10-01T10:00:00+08:00",
      "updated_at": "2026-10-01T10:05:00+08:00"
    }
  ]
}

错误码

错误码 说明
400 参数错误或请求无法解析
401 未认证或凭证无效(缺少/无效的访问凭证)
403 禁止访问,无权限
404 请求路径不存在或资源不存在
500 系统内部错误

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc