跳转到内容

cnb-rs pr commits

cnb-rs pr commits <NUMBER> [-L <N>]

列出指定 Pull Request 包含的 git commits,按 git log 风格输出表格。

选项

  • <NUMBER>:PR 编号(必填)
  • -L, --limit <N>:最大数量(默认 30,CNB 上限 100)

继承的全局选项:

  • --repo <REPO>:指定仓库路径(格式:group/repo
  • --json:以 JSON 输出
  • --domain <DOMAIN>:指定目标域名(默认:cnb.cool

列设计

宽度说明
SHAfixed 8Commit.sha 前 7 位(git 社区惯例)
AUTHORfixed 18优先 Commit.author.username;为空时退到签名里的 Commit.commit.author.name
MESSAGEflexCommit.commit.message 的首行(多行 commit 只展示标题)
DATEfixed 14签名时间 Commit.commit.author.date 转相对时间

示例

bash
# 列出最近 5 个 commit
$ cnb-rs pr commits 271 -L 5

Showing 1 commits in PR #271

SHA       AUTHOR              MESSAGE                               DATE
131545f   CNB Bot             🔧 chore(release): 准备 v0.11.2 发版 1 个月前

# JSON 给脚本消费
$ cnb-rs --json pr commits 271 | jq '.[].sha'

API 调用

步骤API方法
列 commits${API}/repos/{repo}/-/pulls/{n}/commitsGET

另请参阅

Released under the MIT License.