Automatically address unresolved PR review comments, commit fixes, and resolve threads
Fetch unresolved PR review comments, propose fixes for user approval, implement approved changes, commit and push, then mark comments as resolved.
/address-pr-comments - Uses current branch's PR/address-pr-comments 123 - Addresses comments on PR #123If a PR number is provided as an argument, use that. Otherwise:
git branch --show-current
gh pr list --head <branch-name> --json number,url --jq '.[0]'
gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
reviewThreads(first: 50) {
nodes {
id
isResolved
path
line
comments(first: 10) {
nodes {
body
author { login }
}
}
}
}
}
}
}' -f owner=<OWNER> -f repo=<REPO> -F pr=<PR_NUMBER>
Filter to only unresolved threads (isResolved: false).
CRITICAL: Always ask for user confirmation before making changes.
For each unresolved comment:
path fieldOptions:
Only after user approval — make code changes for approved fixes.
git add -A
git commit -m "fix: address PR review comments
- <summary of changes made>"
git push origin <branch-name>
gh api graphql -f query='
mutation {
resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } }
}'