PR Review Workflow
PR Review Workflow
Complete workflow for handling code review feedback from receiving comments to resolving threads.
Overview
┌─────────────────────────────────────┐
│ 1. Receive Code Review Feedback │
│ Review comments on PR │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ 2. Address Feedback │
│ Edit files, run checks, commit │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ 3. Respond to Comments │
│ gh please pr review reply │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ 4. Resolve Threads │
│ gh please pr review thread │
│ resolve --all │
└──────────────┬──────────────────────┘
↓
┌─────────────────────────────────────┐
│ 5. PR Ready for Merge │
│ All feedback addressed │
└─────────────────────────────────────┘
Step 1: Identify Review Comments
View PR with review comments to understand feedback:
# View PR details
gh pr view <pr-number>
# Get detailed comment information
gh api repos/{owner}/{repo}/pulls/<pr-number>/comments
Find comment IDs (v0.11.0+ supports both formats):
- From GitHub Web UI (Database ID):
- Click on review comment
- URL:
github.com/.../pull/123#discussion_r1234567890 - Use number after
discussion_r:1234567890
- List review threads (Node IDs):
gh please pr review thread list <pr-number> - Using gh CLI:
gh pr view --json comments --jq '.comments[] | "\(.id): \(.body)"'
1234567890) and Node ID (string like PRRC_kwDO...) are supported and auto-detected.Step 2: Apply Code Review Feedback
Address all findings from the code review:
# Make necessary changes to files
# Example: Fix type definitions, update docs, refactor code
# Run quality checks
bun run type-check
bun test
bun run lint:fix
# Commit changes
git add .
git commit -m "fix: address code review feedback"
git push
Step 3: Respond to Review Comments
Reply to each review comment with acknowledgment and commit reference:
gh please pr review reply <comment-id> -b "Thanks! Fixed in <commit-hash>"
Supported ID formats:
- Database ID (numeric):
1234567890- automatically converted - Node ID (string):
PRRC_kwDOP34zbs6ShH0J- used directly
Examples:
# Single-line response with Database ID
gh please pr review reply 2442802556 -b "Fixed PluginType definition in commit 75dcaac"
# Single-line response with Node ID
gh please pr review reply PRRC_kwDOP34zbs6ShH0J -b "Fixed PluginType definition in commit 75dcaac"
# Multi-line response
gh please pr review reply 2442802557 --body "$(cat <<'EOF'
Great catch! I've addressed this by:
1. Adding proper error handling
2. Including unit tests
3. Updating documentation
Fixed in commit 75dcaac.
EOF
)"
Response Best Practices:
✅ Include the commit hash that addresses the feedback ✅ Keep responses brief and professional ✅ Confirm understanding of the issue ✅ Reference the fix location when applicable ✅ For multiple related comments, batch similar responses
Step 4: Resolve Review Threads
After addressing feedback and responding, resolve review threads:
Resolve All Threads (Recommended)
gh please pr review thread resolve <pr-number> --all
Example:
# After addressing all feedback
gh please pr review thread resolve 456 --all
Resolve Specific Thread
gh please pr review thread resolve <pr-number> --thread <thread-id>
Example:
gh please pr review thread resolve 456 --thread MDEyOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFk...
Step 5: Verify and Merge
After responding and resolving threads:
# Verify all changes are pushed
git log -1 --oneline
git status
# Check PR status
gh pr checks <pr-number>
# PR is ready for merge
gh pr merge <pr-number>
Complete Example
Real-world example of handling PR #23 feedback:
# 1. Receive feedback on PR #23
gh pr view 23
# 2. Make code changes
# (edit files based on review comments)
git add .
git commit -m "fix: address code review feedback from PR #23"
git push
# 3. Respond to multiple comments (supports both Database ID and Node ID)
gh please pr review reply 2442802556 -b "Fixed PluginType definition in 75dcaac" # Database ID
gh please pr review reply PRRC_kwDOP34zbs6ShH0J -b "Updated docs in 75dcaac" # Node ID
gh please pr review reply 2442802560 -b "Implemented suggestion in 75dcaac"
# 4. Resolve all threads
gh please pr review thread resolve 23 --all
# 5. Ready for merge
gh pr checks 23
Advanced Workflows
Batch Response Script
For PRs with many comments:
#!/bin/bash
# batch-reply.sh
PR_NUMBER=456
COMMIT_HASH="abc123"
COMMENT_IDS=(2442802556 2442802557 2442802560)
for id in "${COMMENT_IDS[@]}"; do
gh please pr review reply "$id" -b "Fixed in commit $COMMIT_HASH"
done
gh please pr review thread resolve "$PR_NUMBER" --all
Comment-Specific Responses
# For each type of feedback
gh please pr review reply 111 -b "Added error handling in abc123"
gh please pr review reply 222 -b "Renamed variable for clarity in abc123"
gh please pr review reply 333 -b "Added unit test in abc123"
gh please pr review reply 444 -b "Updated documentation in abc123"
Tips for Effective Reviews
As a Reviewer
- Be specific - Point to exact lines and suggest improvements
- Explain why - Help others understand the reasoning
- Use suggestions - GitHub's suggestion feature for simple fixes
- Be constructive - Focus on code, not people
As a PR Author
- Respond promptly - Address feedback quickly
- Ask questions - If feedback is unclear, ask for clarification
- Reference commits - Show where each issue was fixed
- Resolve systematically - Work through comments one by one
- Update PR description - Summarize major changes
Troubleshooting
Can't Reply to a Comment
Issue: Error when replying to a comment
Solution:
- Verify it's a top-level review comment, not a reply
- GitHub API doesn't support replying to replies
- Reply on GitHub web UI for nested comments
Thread Won't Resolve
Issue: Thread resolution fails
Solution:
# List all threads to verify IDs
gh api graphql -f query='...'
# Ensure you have permissions
gh pr view <pr-number>
# Try resolving via web UI if command fails
Finding Thread IDs
# List all review threads
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes {
id
isResolved
comments(first: 1) {
nodes { path body }
}
}
}
}
}
}
' -F owner=OWNER -F repo=REPO -F number=PR_NUMBER
Related Commands
# List all PRs with review comments
gh pr list --search "review-requested:@me"
# View specific PR details
gh pr view <pr-number> --json reviews,comments
# Check PR review status
gh pr checks <pr-number>
# Edit PR review comment
gh please pr review comment edit <comment-id> --body "Updated text" [--pr <number>]
# With Database ID (requires --pr option)
gh please pr review comment edit 1234567890 --body "Updated text" --pr 456
# With Node ID (--pr is optional)
gh please pr review comment edit PRRC_kwDOP34zbs6ShH0J --body "Updated text"
Related
- PR Management - PR commands
- Quick Start - Basic commands
- Command Reference - Complete documentation