获取仓库的流水线列表¶
GET /api/v8/repos/{owner}/{repo}/actions/workflows
获取指定仓库的流水线(workflow)列表,支持分页以及按流水线名称进行模糊筛选。
访问令牌支持说明¶
- AtomGit 用户访问令牌(AtomGit user access tokens)
是否允许匿名访问¶
此接口允许匿名访问
请求参数¶
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
owner |
path | string | 是 | 仓库所属空间地址(组织或个人的地址 path) |
repo |
path | string | 是 | 仓库路径(path) |
per_page |
query | integer | 否 | 每页的数量,最大为 100,默认 20 |
page |
query | integer | 否 | 当前的页码,默认为 1 |
workflow_name |
query | string | 否 | 流水线(workflow)名称,模糊匹配 |
响应参数¶
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
total_count |
integer | 是 | 否 | 总数量 |
workflows |
object[] | 是 | 否 | 流水线列表 |
workflows 数组元素
| 字段 | 类型 | 必返 | 可为空 | 说明 |
|---|---|---|---|---|
workflow_id |
string | 是 | 否 | 流水线 id |
file_path |
string | 是 | 否 | 流水线配置文件 |
name |
string | 是 | 否 | 流水线名称 |
state |
string | 是 | 否 | 流水线状态 |
失败响应¶
该接口无业务失败响应。
HTTP 响应状态码¶
| 状态码 | 说明 |
|---|---|
200 |
成功(OK) |
401 |
需要认证(Requires authentication) |
403 |
禁止访问(Forbidden) |
404 |
资源不存在(Not found) |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
请求示例¶
参数说明¶
<owner>替换为仓库所属空间地址(组织或个人的地址 path);<repo>替换为仓库路径(path)。
该接口允许匿名访问,示例中无需携带令牌;如需鉴权,也可在查询参数中附加 <token>(AtomGit 用户访问令牌)。
cURL¶
curl -X GET 'https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/workflows?per_page=20&page=1' \
-H 'Accept: application/json'
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch(
"https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/workflows?per_page=20&page=1",
{
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/workflows",
params={"per_page": 20, "page": 1},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
响应示例¶
状态码: 200
{
"total_count": 0,
"workflows": [
{
"workflow_id": "string",
"file_path": "string",
"name": "string",
"state": "string"
}
]
}
错误码¶
| 错误码 | 说明 |
|---|---|
401 |
未认证或凭证无效(缺少/无效的访问凭证) |
403 |
禁止访问 |
404 |
请求路径不存在 |
429 |
请求过于频繁,触发限流 |
500 |
系统内部错误 |
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc