@@ -42,13 +42,31 @@ gh api repos/${REPO}/issues/comments/{COMMENT_ID} | jq '{body: .body, user: .use
4242** If a specific review ID is provided (` #pullrequestreview-... ` ):**
4343
4444``` bash
45- gh api repos/${REPO} /pulls/{PR_NUMBER}/reviews/{REVIEW_ID}/comments | jq ' [.[] | {id: .id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login}]'
45+ # Review body (often contains summary feedback)
46+ gh api repos/${REPO} /pulls/{PR_NUMBER}/reviews/{REVIEW_ID} | jq ' {id: .id, body: .body, state: .state, user: .user.login, html_url: .html_url}'
47+
48+ # Inline comments for this review
49+ gh api --paginate repos/${REPO} /pulls/{PR_NUMBER}/reviews/{REVIEW_ID}/comments | jq ' [.[] | {id: .id, node_id: .node_id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'
4650```
4751
48- ** If only PR number is provided (fetch all PR review comments):**
52+ Include the review body as a general comment when it contains actionable feedback.
53+
54+ ** If only PR number is provided (fetch all PR comments):**
4955
5056``` bash
51- gh api repos/${REPO} /pulls/{PR_NUMBER}/comments | jq ' [.[] | {id: .id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'
57+ # Inline code review comments
58+ gh api --paginate repos/${REPO} /pulls/{PR_NUMBER}/comments | jq ' [.[] | {id: .id, node_id: .node_id, type: "review", path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'
59+
60+ # General PR discussion comments (not tied to specific lines)
61+ gh api --paginate repos/${REPO} /issues/{PR_NUMBER}/comments | jq ' [.[] | {id: .id, node_id: .node_id, type: "issue", body: .body, user: .user.login, html_url: .html_url}]'
62+ ```
63+
64+ For review comments, fetch review thread metadata and attach ` thread_id ` by matching each review comment's ` node_id ` :
65+
66+ ``` bash
67+ OWNER=${REPO%/* }
68+ NAME=${REPO#*/ }
69+ gh api graphql --paginate -f owner=" ${OWNER} " -f name=" ${NAME} " -F pr={PR_NUMBER} -f query=' query($owner:String!, $name:String!, $pr:Int!, $endCursor:String) { repository(owner:$owner, name:$name) { pullRequest(number:$pr) { reviewThreads(first:100, after:$endCursor) { nodes { id isResolved comments(first:100) { nodes { id databaseId } } } pageInfo { hasNextPage endCursor } } } } }' | jq ' [.data.repository.pullRequest.reviewThreads.nodes[] | {thread_id: .id, is_resolved: .isResolved, comments: [.comments.nodes[] | {node_id: .id, id: .databaseId}]}]'
5270```
5371
5472** Filtering comments:**
@@ -118,13 +136,7 @@ gh api repos/${REPO}/issues/{PR_NUMBER}/comments -X POST -f body="<response>"
118136gh api repos/${REPO} /pulls/{PR_NUMBER}/comments/{COMMENT_ID}/replies -X POST -f body=" <response>"
119137```
120138
121- ** For standalone review comments (not in a thread):**
122-
123- ``` bash
124- gh api repos/${REPO} /pulls/{PR_NUMBER}/comments -X POST -f body=" <response>" -f commit_id=" <COMMIT_SHA>" -f path=" <FILE_PATH>" -f line=< LINE_NUMBER> -f side=" RIGHT"
125- ```
126-
127- Note: ` side ` is required when using ` line ` . Use ` "RIGHT" ` for the PR commit side (most common) or ` "LEFT" ` for the base commit side.
139+ Use the ` /replies ` endpoint for all existing review comments, including standalone top-level comments.
128140
129141The response should briefly explain:
130142
0 commit comments