列出仓库的 Artifacts¶
GET /api/v8/repos/{owner}/{repo}/actions/artifacts
分页查询仓库下的制品,支持按名称过滤及排序。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
owner |
path | string | 是 | 仓库所属空间地址(组织或个人的地址 path) |
repo |
path | string | 是 | 仓库路径(path) |
name |
query | string | 否 | 制品名称过滤(模糊匹配) |
sort |
query | string | 否 | 排序字段,当前仅支持 created |
direction |
query | string | 否 | 排序方向,asc 或 desc |
page |
query | integer | 否 | 当前页码,默认 1 |
per_page |
query | integer | 否 | 每页的项目数,默认 10 |
响应参数¶
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
total_count |
integer | 是 | 否 | 制品总数 |
artifacts |
object[] | 是 | 否 | 制品列表 |
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 | 是 | 否 | 过期时间(毫秒时间戳) |
artifacts.created_at |
string | 是 | 否 | 创建时间(毫秒时间戳) |
artifacts.updated_at |
string | 是 | 否 | 更新时间(毫秒时间戳) |
失败响应¶
接口正常情况下仅返回 200;以下为网关/鉴权层可能返回的通用失败形态,字段名以后端实际返回为准。
400 参数错误
401 未认证
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
304 |
未修改(Not modified) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
请求示例¶
参数说明¶
示例中的占位符均可直接替换后调用:
<owner>替换为仓库所属空间地址(组织或个人的地址 path);<repo>替换为仓库路径(path)。
此接口允许匿名访问,示例无需携带认证信息;如需访问私有仓库或提升调用限额,也可携带 AtomGit 用户访问令牌。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/artifacts?page=1&per_page=10' \
-H 'Accept: application/json'
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const params = new URLSearchParams({
page: "1",
per_page: "10",
});
const response = await fetch(
`https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/artifacts?${params}`,
{
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/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": "art-123",
"name": "build-output",
"size_bytes": 1048576,
"workflow_id": "wf-1",
"workflow_run_id": "run-1",
"digest": "sha256:0123...",
"expires_at": "1720000000000",
"created_at": "1710000000000",
"updated_at": "1710000000000"
}
]
}
错误码¶
| 错误码 | 说明 |
|---|---|
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
400 |
参数错误或请求无法解析 |
404 |
请求路径不存在 |
405 |
请求方法不支持 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc