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)
列设计
| 列 | 宽度 | 说明 |
|---|---|---|
| SHA | fixed 8 | Commit.sha 前 7 位(git 社区惯例) |
| AUTHOR | fixed 18 | 优先 Commit.author.username;为空时退到签名里的 Commit.commit.author.name |
| MESSAGE | flex | Commit.commit.message 的首行(多行 commit 只展示标题) |
| DATE | fixed 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}/commits | GET |