Loading...
Loading...
Merges GitHub Pull Requests after validating pre-merge checklist. Use when user wants to merge PR, close PR, finalize PR, complete merge, approve and merge, or execute merge. Runs pre-merge validation (tests, lint, CI, comments), confirms with user, merges with proper format, handles post-merge cleanup.
npx skill4agent add fvadicamo/dev-agent-skills github-pr-merge# 1. Get PR info
PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
# 2. Run pre-merge checklist
make test && make lint && gh pr checks $PR
# 3. Verify all comments replied
gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length'
# 4. Merge with concise message (--delete-branch auto-deletes remote)
gh pr merge $PR --merge --delete-branch --body "- Change 1
- Change 2
Reviews: N/N addressed
Tests: X passed (Y% cov)
Refs: Task N"
# 5. Post-merge cleanup (local only, remote already deleted)
git checkout develop && git pull && git branch -d feature/<name>| Check | Command | Required |
|---|---|---|
| Tests passing | | Yes |
| Linting passing | | Yes |
| CI checks green | | Yes |
| All comments replied | Verify only, don't reply | Yes |
| No unresolved threads | Review PR page | Yes |
PR=$(gh pr view --json number -q '.number')
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
echo "PR #$PR in $REPO"# Count original comments (not replies)
ORIGINALS=$(gh api repos/$REPO/pulls/$PR/comments --jq '[.[] | select(.in_reply_to_id == null)] | length')
# Count comments that have at least one reply
REPLIED=$(gh api repos/$REPO/pulls/$PR/comments --jq '
[.[] | select(.in_reply_to_id)] | [.[].in_reply_to_id] | unique | length
')
echo "Original comments: $ORIGINALS, With replies: $REPLIED"
# Find unreplied comment IDs
UNREPLIED=$(gh api repos/$REPO/pulls/$PR/comments --jq '
[.[] | select(.in_reply_to_id) | .in_reply_to_id] as $replied_ids |
[.[] | select(.in_reply_to_id == null) | select(.id | IN($replied_ids[]) | not) | .id]
')
echo "Unreplied: $UNREPLIED"# Activate venv if Python project
source venv/bin/activate 2>/dev/null
# Run tests
make test
# Run linting
make lint # or: make check
# Check CI status
gh pr checks $PRgh pr view $PR --json title,body,commits,changedFiles --jq '
"Title: \(.title)\nCommits: \(.commits | length)\nFiles: \(.changedFiles)"
'Pre-merge checklist verified:
- Tests: passing
- Lint: passing
- CI: green
- Comments: all replied
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--delete-branch# Switch to develop and update (--delete-branch already deleted local+remote)
git checkout develop
git pull origin develop--delete-branchgit branch -d feature/<branch-name> # local
git push origin --delete feature/<branch-name> # remote- 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