gh-modify-pr
Use this workflow for PR-comment-driven changes.
Inputs
- - PR URL (preferred), e.g. INLINECODE0
- Optional scope from user (e.g. only one comment, all unresolved comments)
Workflow
- 1. Parse owner/repo and PR number from URL.
- Inspect PR summary:
-
gh pr view <url> --json number,title,headRefName,baseRefName,files,reviews,reviewDecision
- 3. Fetch inline review comments:
-
gh api repos/<owner>/<repo>/pulls/<number>/comments
- 4. Extract actionable items from comment bodies.
- Ensure local repo exists in workspace:
- If missing:
git clone git@github.com:<owner>/<repo>.git
- 6. Checkout PR branch in local repo:
-
gh pr checkout <number>
- 7. Open affected files and implement requested changes exactly.
- Validate changed files quickly (lint/test only if needed or requested).
- Commit:
-
git add <files>
-
git commit -m "<clear message>"
- 10. Report back with:
- What changed
- Commit hash
- Branch name
- 11. Push only if user asks/approves:
- INLINECODE7
Rules
- - Prefer minimal diffs that address reviewer intent directly.
- Do not silently alter unrelated code.
- If a comment is ambiguous, ask one focused clarification question.
- If no local repo exists, clone first instead of failing.
- Include failed attempts in the final operation log when user asks for traceability.
Handy commands
CODEBLOCK0
Output template
- - PR: INLINECODE8
- Addressed comments: INLINECODE9
- Changed files:
-
<path>:
<summary>
- - Commit: INLINECODE12
- Branch: INLINECODE13
- Pushed: INLINECODE14
gh-modify-pr
使用此工作流处理由PR评论驱动的变更。
输入
- - PR URL(首选),例如 https://github.com/owner/repo/pull/123
- 用户可选的作用域(例如仅处理某条评论,或所有未解决的评论)
工作流
- 1. 从URL解析仓库所有者/仓库名和PR编号。
- 检查PR摘要:
- gh pr view
--json number,title,headRefName,baseRefName,files,reviews,reviewDecision
- 3. 获取内联审查评论:
- gh api repos///pulls//comments
- 4. 从评论正文中提取可操作项。
- 确保本地仓库存在于工作区:
- 如果不存在:git clone git@github.com:/.git
- 6. 在本地仓库中检出PR分支:
- gh pr checkout
- 7. 打开受影响的文件并精确实施所请求的变更。
- 快速验证已更改的文件(仅在需要或要求时进行lint/测试)。
- 提交:
- git add
- git commit -m <清晰的消息>
- 10. 报告以下内容:
- 变更内容
- 提交哈希
- 分支名称
- 11. 仅在用户要求/批准时推送:
- git push
规则
- - 优先采用直接满足审查者意图的最小差异。
- 不要静默修改不相关的代码。
- 如果评论存在歧义,提出一个有针对性的澄清问题。
- 如果本地仓库不存在,先克隆而不是直接失败。
- 当用户要求可追溯性时,在最终操作日志中包含失败的尝试。
便捷命令
bash
PR元数据
gh pr view --json number,title,headRefName,baseRefName,files,reviews,reviewDecision
内联审查评论
gh api repos///pulls//comments
检出PR分支(在仓库内)
gh pr checkout
状态和提交
git status --short
git add
git commit -m chore: 处理PR审查评论
输出模板
- :<摘要>