feat(pr): 新增 pr +commits 读 PR 提交列表(端点实测忽略分页参数)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
78fa470b94
commit
ce8db5912e
|
|
@ -55,6 +55,8 @@
|
|||
issue 讨论上下文;现接 `/v1/:owner/:repo/issues/:number/journals`
|
||||
(资源键 `journals`,生产实测分页 + --all 合并通过),
|
||||
复用 --number/--id 语义。
|
||||
- 新增 `pr +commits` 子命令:读 PR 的提交列表(commits 端点);
|
||||
生产实测该端点同样忽略 page/limit 始终全量,故不暴露分页 flag。
|
||||
- 新增 `pr +comments` 子命令:读 PR 评论流
|
||||
(`/v1/:owner/:repo/pulls/:number/journals`)。生产实测该端点
|
||||
忽略 page/limit 始终返回全量,故不暴露分页 flag(避免假分页语义)。
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
"cmd.pr.close.short": "Close a pull request",
|
||||
"cmd.pr.comment.short": "Add a comment to a pull request",
|
||||
"cmd.pr.comments.short": "List comments on a pull request",
|
||||
"cmd.pr.commits.short": "List commits on a pull request",
|
||||
"cmd.pr.create.short": "Create a pull request",
|
||||
"cmd.pr.diff.short": "Show diff for a pull request",
|
||||
"cmd.pr.files.short": "List changed files in a pull request",
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
"cmd.pr.close.short": "关闭拉取请求",
|
||||
"cmd.pr.comment.short": "给拉取请求添加评论",
|
||||
"cmd.pr.comments.short": "列出 PR 的评论",
|
||||
"cmd.pr.commits.short": "列出 PR 的提交",
|
||||
"cmd.pr.create.short": "创建拉取请求",
|
||||
"cmd.pr.diff.short": "显示拉取请求 diff",
|
||||
"cmd.pr.files.short": "列出拉取请求中的变更文件",
|
||||
|
|
|
|||
|
|
@ -439,6 +439,26 @@ func Shortcuts(translators ...*i18n.Translator) []*common.Shortcut {
|
|||
return ctx.Output(env)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "commits",
|
||||
Description: tr.T("cmd.pr.commits.short"),
|
||||
Flags: []common.Flag{
|
||||
{Name: "id", Short: "i", Usage: tr.T("flag.pr.id"), Required: true},
|
||||
},
|
||||
Run: func(ctx *common.RuntimeContext) error {
|
||||
if err := ctx.ResolveOwnerRepo(); err != nil {
|
||||
return err
|
||||
}
|
||||
id, _ := ctx.RequireArg("id")
|
||||
// The pulls commits endpoint ignores page/limit and always
|
||||
// returns the full list, so no pagination flags are exposed.
|
||||
env, err := ctx.CallAPI("GET", fmt.Sprintf("%s/pulls/%s/commits", ctx.RepoPath(), id), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctx.Output(env)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "comments",
|
||||
Description: tr.T("cmd.pr.comments.short"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue