File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 5858 # Additional context: all comments, all reviews, and PR diff
5959 gh api "repos/$REPO/issues/$PR_NUM/comments" --paginate > /tmp/pr-comments.json
6060 gh api "repos/$REPO/pulls/$PR_NUM/reviews" --paginate > /tmp/all-reviews.json
61+ gh api "repos/$REPO/pulls/$PR_NUM/comments" --paginate > /tmp/all-review-comments.json
6162 gh api "repos/$REPO/pulls/$PR_NUM" -H "Accept: application/vnd.github.diff" > /tmp/pr.diff
6263
6364 # Fetch linked issues referenced in the PR body
@@ -232,6 +233,35 @@ jobs:
232233 prompt+="$rev_body"
233234 prompt+=$'\n'
234235 fi
236+
237+ # Include inline comments for this review
238+ rev_comments=$(jq -r --argjson rid "$rid" '[.[] | select(.pull_request_review_id == $rid)]' /tmp/all-review-comments.json)
239+ num_rev_comments=$(echo "$rev_comments" | jq 'length')
240+
241+ if [ "$num_rev_comments" -gt 0 ]; then
242+ for j in $(seq 0 $((num_rev_comments - 1))); do
243+ rc_path=$(echo "$rev_comments" | jq -r ".[$j].path")
244+ rc_line=$(echo "$rev_comments" | jq -r ".[$j].line // .[$j].original_line // \"?\"")
245+ rc_body=$(echo "$rev_comments" | jq -r ".[$j].body")
246+ rc_diff_hunk=$(echo "$rev_comments" | jq -r ".[$j].diff_hunk // \"\"")
247+
248+ prompt+=$'\n'
249+ prompt+="**$rc_path** (line $rc_line):"
250+ prompt+=$'\n\n'
251+
252+ if [ -n "$rc_diff_hunk" ] && [ "$rc_diff_hunk" != "null" ]; then
253+ prompt+='```diff'
254+ prompt+=$'\n'
255+ prompt+="$rc_diff_hunk"
256+ prompt+=$'\n'
257+ prompt+='```'
258+ prompt+=$'\n\n'
259+ fi
260+
261+ prompt+="$rc_body"
262+ prompt+=$'\n'
263+ done
264+ fi
235265 done
236266 fi
237267
You can’t perform that action at this time.
0 commit comments