github-pr-merge by fvadicamo/dev-agent-skills
npx skills add https://github.com/fvadicamo/dev-agent-skills --skill github-pr-merge包含 Shell 命令
此技能包含可能执行系统命令的 shell 命令指令(!command``)。安装前请仔细审查。
在验证合并前检查清单并处理合并后清理后,合并 Pull Requests。
!gh pr view --json number,title,state -q '"PR #\(.number): \(.title) (\(.state))"' 2>/dev/null
验证所有审查评论至少有一个回复:
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
PR=$(gh pr view --json number -q '.number')
# 查找未回复的评论 ID
gh api repos/$REPO/pulls/$PR/comments --jq '
[.[] | select(.in_reply_to_id) | .in_reply_to_id] as $replied |
[.[] | select(.in_reply_to_id == null) | select(.id | IN($replied[]) | not) | .id]
'
如果存在未回复的评论:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
gh pr view $PR --json milestone -q '.milestone.title // "none"'
如果已分配里程碑:将其包含在检查清单摘要中(步骤 3)
如果没有里程碑:检查是否存在开放的里程碑并警告用户
gh api repos/$REPO/milestones --jq '[.[] | select(.state=="open")] | length'
如果存在开放的里程碑但 PR 没有分配,则在检查清单中显示警告:- 里程碑:⚠ 未分配(存在开放的里程碑)
不要因为缺少里程碑而阻止合并。这只是一个警告。
运行测试、代码检查并验证 CI 检查。在继续之前,所有检查必须通过。
gh pr checks $PR
在合并前,务必显示检查清单摘要并询问:
合并前检查清单:
- 评论:全部已回复
- 测试:通过
- 代码检查:通过
- CI:通过
- 里程碑:v0.1.0(或 ⚠ 未分配)
准备合并 PR #X。是否继续?
gh pr merge $PR --merge --delete-branch --body "$(cat <<'EOF'
- 关键变更 1
- 关键变更 2
- 关键变更 3
审查:N/N 已处理
测试:X 通过(覆盖率 Y%)
参考:任务 N,需求 M
EOF
)"
合并策略:始终使用 --merge(合并提交),切勿使用 squash 或 rebase。
--delete-branch 在合并后自动删除远程分支。
git checkout develop && git pull origin develop
如果 PR 有里程碑,检查是否所有事项现已关闭:
MILESTONE=$(gh pr view $PR --json milestone -q '.milestone.number // empty')
if [ -n "$MILESTONE" ]; then
gh api repos/$REPO/milestones/$MILESTONE \
--jq '"开放:\(.open_issues) | 已关闭:\(.closed_issues) | \(.title)"'
fi
如果 open_issues == 0:通知用户并询问是否关闭里程碑
gh api repos/$REPO/milestones/$MILESTONE --method PATCH --field state="closed"
如果 open_issues > 0:报告剩余开放事项的数量。无需操作。
切勿在没有用户明确确认的情况下自动关闭里程碑。
简洁的格式,保持 git 日志清晰:
- 关键变更 1(添加/修复了什么)
- 关键变更 2
- 关键变更 3
审查:7/7 已处理(Gemini 5,Codex 2)
测试:628 通过(覆盖率 88%)
参考:任务 8,需求 14-15
--merge),切勿使用 squash/rebase每周安装数
116
代码仓库
GitHub 星标数
54
首次出现
2026 年 1 月 21 日
安全审计
安装于
opencode95
claude-code94
gemini-cli93
codex91
cursor86
github-copilot83
Contains Shell Commands
This skill contains shell command directives (!command``) that may execute system commands. Review carefully before installing.
Merges Pull Requests after validating pre-merge checklist and handling post-merge cleanup.
!gh pr view --json number,title,state -q '"PR #\(.number): \(.title) (\(.state))"' 2>/dev/null
Verify all review comments have at least one reply:
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
PR=$(gh pr view --json number -q '.number')
# Find unreplied comment IDs
gh api repos/$REPO/pulls/$PR/comments --jq '
[.[] | select(.in_reply_to_id) | .in_reply_to_id] as $replied |
[.[] | select(.in_reply_to_id == null) | select(.id | IN($replied[]) | not) | .id]
'
If unreplied comments exist:
gh pr view $PR --json milestone -q '.milestone.title // "none"'
If milestone is assigned: include it in the checklist summary (step 3)
If no milestone: check for open milestones and warn the user
gh api repos/$REPO/milestones --jq '[.[] | select(.state=="open")] | length'
If open milestones exist but the PR has none, surface a warning in the checklist: - Milestone: ⚠ not assigned (open milestones exist)
Do NOT block the merge for a missing milestone. It is a warning only.
Run tests, linting, and verify CI checks. All MUST pass before proceeding.
gh pr checks $PR
ALWAYS show checklist summary and ask before merging:
Pre-merge checklist:
- Comments: all replied
- Tests: passing
- Lint: passing
- CI: green
- Milestone: v0.1.0 (or ⚠ not assigned)
Ready to merge PR #X. Proceed?
gh pr merge $PR --merge --delete-branch --body "$(cat <<'EOF'
- Key change 1
- Key change 2
- Key change 3
Reviews: N/N addressed
Tests: X passed (Y% cov)
Refs: Task N, Req M
EOF
)"
Merge strategy : always --merge (merge commit), never squash or rebase.
--delete-branch automatically deletes the remote branch after merge.
git checkout develop && git pull origin develop
If the PR had a milestone, check whether all items are now closed:
MILESTONE=$(gh pr view $PR --json milestone -q '.milestone.number // empty')
if [ -n "$MILESTONE" ]; then
gh api repos/$REPO/milestones/$MILESTONE \
--jq '"Open: \(.open_issues) | Closed: \(.closed_issues) | \(.title)"'
fi
If open_issues == 0: inform the user and ask whether to close the milestone
gh api repos/$REPO/milestones/$MILESTONE --method PATCH --field state="closed"
If open_issues > 0: report remaining open items count. No action needed.
NEVER close a milestone automatically without explicit user confirmation.
Concise format for a clean git log:
- Key change 1 (what was added/fixed)
- Key change 2
- Key change 3
Reviews: 7/7 addressed (Gemini 5, Codex 2)
Tests: 628 passed (88% cov)
Refs: Task 8, Req 14-15
--merge), never squash/rebaseWeekly Installs
116
Repository
GitHub Stars
54
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode95
claude-code94
gemini-cli93
codex91
cursor86
github-copilot83