Closed
feat(actions): 支持 获取 Artifact 详情 API #441
aflyingtoAdd on Jul 9Closed at Jul 10
aflyingto
Jul 10 Comments:
Jul 10 Comments:
重开记录(按 AGENTS §9 判定"未完成主干合入")
#441 此前 closed 但:verify-remote-facts 失败(closed 无 merged PR);origin/main 无 gc actions artifact view 代码(pkg/cmd/actions/artifact/ 仅有 list);0 评论无关闭原因;labels 仍 status/triage(非 status/merged)。判定未完成主干合入(与 #449/#450 同源,疑似批量关闭未交付项)。重开以按全流程交付。
验证记录
- 需求确认: GitCode API v8 提供
GET /api/v8/repos/{owner}/{repo}/actions/artifacts/{artifact_id}(获取 Artifact 详情),响应为单个 Artifact 对象(同 #439 的 Artifact 类型:id/name/size_bytes/workflow_id/workflow_run_id/digest/expires_at/created_at/updated_at,时间为字符串型毫秒时间戳)。 - gc 现状: 有
gc actions artifact list(#439/#447),无artifact view;api 无 GetActionsArtifact。 - 结论: 需求有效且未实现,进入开发
实现计划
- API 层:
GetActionsArtifact(client, owner, repo, artifactID) → (*Artifact, json.RawMessage, error)(RawREST 走 v8 artifacts/{artifact_id},复用 Artifact 类型,返回 typed+raw 同 #446 GetActionsRun 模式,--json 忠实透传)。 - 命令层:
gc actions artifact view <artifact-id> -R owner/repo [--json](位置参数 artifact_id;--json 输出 raw、人类视图 artifact 元信息 + size 人类可读 + ms 时间);注册到 artifact 父组。 - 真实验证: infra-test 404 + wangjing_127(有 runs 但无 artifacts,验 404/run-scoped 路由;填充由单测覆盖)。


背景
GitCode API 文档 2.0.0 已提供 Actions API。该 Issue 用于跟踪 gitcode-cli 对此接口的支持设计与实现。
API 摘要
GET/api/v8/repos/{owner}/{repo}/actions/artifacts/{artifact_id}get_api_v8_repos_{owner}_{repo}_actions_artifacts_{artifact_id}pipeline-v8falseRequest Parameters
ownerrepoartifact_idaccess_tokenRequest Body
无。
Responses
200
application/jsonapplication/json schema
{ "type": "object", "properties": { "id": { "type": "string", "description": "制品ID" }, "name": { "type": "string", "description": "制品名称" }, "size_bytes": { "type": "integer", "description": "制品大小(字节)" }, "workflow_id": { "type": "string", "description": "工作流ID" }, "workflow_run_id": { "type": "string", "description": "工作流运行ID" }, "digest": { "type": "string", "description": "SHA256 摘要" }, "expires_at": { "type": "string", "description": "过期时间(毫秒时间戳)" }, "created_at": { "type": "string", "description": "创建时间(毫秒时间戳)" }, "updated_at": { "type": "string", "description": "更新时间(毫秒时间戳)" } }, "description": "com.gitcode.openapi.pojo.artifact.BizArtifactItemResp" }原始 OpenAPI Operation
{ "deprecated": false, "description": "查询仓库下指定制品的详情。", "operationId": "get_api_v8_repos_{owner}_{repo}_actions_artifacts_{artifact_id}", "tags": [ "pipeline-v8" ], "parameters": [ { "name": "owner", "in": "path", "description": "仓库所属空间地址(组织或个人的地址path)", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "仓库路径(path)", "required": true, "schema": { "type": "string" } }, { "name": "artifact_id", "in": "path", "description": "制品id", "required": true, "schema": { "type": "string" } }, { "name": "access_token", "in": "query", "description": "", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "制品ID" }, "name": { "type": "string", "description": "制品名称" }, "size_bytes": { "type": "integer", "description": "制品大小(字节)" }, "workflow_id": { "type": "string", "description": "工作流ID" }, "workflow_run_id": { "type": "string", "description": "工作流运行ID" }, "digest": { "type": "string", "description": "SHA256 摘要" }, "expires_at": { "type": "string", "description": "过期时间(毫秒时间戳)" }, "created_at": { "type": "string", "description": "创建时间(毫秒时间戳)" }, "updated_at": { "type": "string", "description": "更新时间(毫秒时间戳)" } }, "description": "com.gitcode.openapi.pojo.artifact.BizArtifactItemResp" } } }, "headers": {} } }, "security": [], "method": "get", "path": "/api/v8/repos/{owner}/{repo}/actions/artifacts/{artifact_id}", "servers": [ { "url": "https://api.gitcode.com", "description": "正式环境" } ], "securitySchemes": {}, "info": { "title": "GicodeOpenAPI", "description": "", "version": "1.0.0" }, "postman": { "name": "获取 Artifact 详情", "description": { "content": "查询仓库下指定制品的详情。", "type": "text/plain" }, "url": { "path": [ "api", "v8", "repos", ":owner", ":repo", "actions", "artifacts", ":artifact_id" ], "host": [ "{{baseUrl}}" ], "query": [ { "disabled": false, "key": "access_token", "value": "" } ], "variable": [ { "disabled": false, "description": { "content": "(Required) 仓库所属空间地址(组织或个人的地址path)", "type": "text/plain" }, "type": "any", "value": "", "key": "owner" }, { "disabled": false, "description": { "content": "(Required) 仓库路径(path)", "type": "text/plain" }, "type": "any", "value": "", "key": "repo" }, { "disabled": false, "description": { "content": "(Required) 制品id", "type": "text/plain" }, "type": "any", "value": "", "key": "artifact_id" } ] }, "header": [ { "key": "Accept", "value": "application/json" } ], "method": "GET" } }初步验收建议
infra-test/*仓库。access_token仅作为 API 参数记录,CLI 优先复用现有认证机制。