已关闭
enhance(actions): gc actions run list --created/--commit 过滤 #512
aflyingto创建于  8月10日关闭于  8月25日
aflyingto成员
8月10日 创建

背景

拆自专项 issue gitcode-cli/cli#506 §2.2。对齐 gh run list 的过滤能力。

现状

gc actions run list 支持 --status/--event/--branch/--executor/--workflow/--workflow-id/--pr。gh 额外有 --commit/--created/--user。

需求

--created <date>

按创建时间过滤。API 已有 startTime/endTime 参数(见 api.ActionsListRunsOptions 和 api/queries_actions.go 中的 SetInt64("startTime"...) / SetInt64("endTime"...)),但 gc 未暴露为 flag。

将 --created 解析为日期,映射到 API 的 startTime 参数(当天 00:00:00 的 Unix 时间戳)。

--commit <SHA>

按 commit SHA 过滤。GitCode API 无直接参数,在客户端对 head_sha 字段过滤。

命令接口(增强后)

gc actions run list -R owner/repo [flags]

新增 Flags:

  • --created <date>:按创建日期过滤(格式 YYYY-MM-DD)
  • --commit <SHA>:按 commit SHA 过滤(客户端过滤)

对齐 gh 参考

gh run list [--branch <branch>] [--commit <SHA>] [--created <date>] [--event <event>] [--status <status>] [--user <user>]

验收标准

Refs gitcode-cli/cli#506

likedislike
Aaflyingto成员
8月10日 添加了label:agent-friendlyenhancementscope/actions
Aaflyingto成员
8月11日 关联了里程碑:gh-parity: 全面对齐 gh CLI
aflyingto成员
8月19日 评论:

验证记录

  • 当前版本或分支: main @ cf2b61a7da001bdfc6579c08a4e211afea569778
  • 复现命令: gc actions run list --help
  • 实际结果: 当前命令帮助仅包含 status、event、branch、executor、workflow、workflow-id、pr 等过滤项,不包含 created 或 commit;origin/main 与 github/main 均指向上述提交,Issue 要求尚未进入主干。
  • 结论: 需求有效,继续实现;范围仅限 created 日期过滤、commit head_sha 客户端过滤、测试和命令文档。
likedislike
Aaflyingto成员
8月19日 添加了label:status/verified,type/feature
Aaflyingto成员
8月19日 添加了label:status/in-progress
Aaflyingto成员
8月19日 关联了pull request:[WIP]feat(actions): filter runs by date and commit
aflyingto成员
8月25日 评论:

开发进度

  • 当前状态: ready-for-review
  • 根因: Actions v8 的 startTime 未暴露为命令 flag,且 API 不支持 commit 参数。
  • 主要修改: 新增 --created 服务端时间过滤与 --commit 客户端 head_sha 精确过滤,补齐组合分页测试和文档。
  • 影响范围: actions run list 命令、对应单元测试和 docs/COMMANDS.md。
  • 单元测试: go test ./... 通过;变更包覆盖率 85.1%。
  • 构建: go build ./cmd/gc 通过。
  • 实际命令验证: infra-test/gctest1 上日期过滤、无效日期和空 JSON 契约验证通过;无 Actions run,commit 正向命中由单元测试覆盖。
  • 安全影响: 只读能力;pre-commit/pre-push 与 gitleaks 通过,无凭证或写路径变化。
  • 文档同步: docs/COMMANDS.md 与 help 已同步。
  • 风险或未覆盖项: medium;真实测试仓无 Actions run,未覆盖 commit 正向命中。
  • 关联 PR: GitCode PR 513
likedislike
Aaflyingto成员
8月25日 添加了label:status/ready-for-review
Aaflyingto成员
8月25日 删除了label:status/in-progress
Aaflyingto成员
8月25日 关闭了 issue
Aaflyingto成员
8月25日 添加了label:status/merged;删除了label:status/ready-for-review