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
@@ -236,6 +237,35 @@ jobs:
236237 prompt+="$rev_body"
237238 prompt+=$'\n'
238239 fi
240+
241+ # Include inline comments for this review
242+ rev_comments=$(jq -r --argjson rid "$rid" '[.[] | select(.pull_request_review_id == $rid)]' /tmp/all-review-comments.json)
243+ num_rev_comments=$(echo "$rev_comments" | jq 'length')
244+
245+ if [ "$num_rev_comments" -gt 0 ]; then
246+ for j in $(seq 0 $((num_rev_comments - 1))); do
247+ rc_path=$(echo "$rev_comments" | jq -r ".[$j].path")
248+ rc_line=$(echo "$rev_comments" | jq -r ".[$j].line // .[$j].original_line // \"?\"")
249+ rc_body=$(echo "$rev_comments" | jq -r ".[$j].body")
250+ rc_diff_hunk=$(echo "$rev_comments" | jq -r ".[$j].diff_hunk // \"\"")
251+
252+ prompt+=$'\n'
253+ prompt+="**$rc_path** (line $rc_line):"
254+ prompt+=$'\n\n'
255+
256+ if [ -n "$rc_diff_hunk" ] && [ "$rc_diff_hunk" != "null" ]; then
257+ prompt+='```diff'
258+ prompt+=$'\n'
259+ prompt+="$rc_diff_hunk"
260+ prompt+=$'\n'
261+ prompt+='```'
262+ prompt+=$'\n\n'
263+ fi
264+
265+ prompt+="$rc_body"
266+ prompt+=$'\n'
267+ done
268+ fi
239269 done
240270 fi
241271
You can’t perform that action at this time.
0 commit comments