|
33 | 33 | Use the GitHub CLI to fetch the PR details: |
34 | 34 |
|
35 | 35 | <execute_command> |
36 | | - <command>gh pr view [PR_NUMBER] --repo [owner]/[repo] --json number,title,body,author,state,url,headRefName,baseRefName,mergeable,isDraft,createdAt,updatedAt</command> |
| 36 | + <command>gh pr view [PR_NUMBER] --repo [owner]/[repo] --json number,title,body,author,state,url,headRefName,baseRefName,headRefOid,mergeable,isDraft,createdAt,updatedAt</command> |
37 | 37 | </execute_command> |
38 | 38 |
|
39 | 39 | Parse the JSON output to understand the PR's current state and metadata. |
| 40 | + IMPORTANT: Save the headRefOid value as it will be needed for submitting the review via the API. |
40 | 41 |
|
41 | 42 | <update_todo_list> |
42 | 43 | <todos> |
|
124 | 125 |
|
125 | 126 | Also fetch review details: |
126 | 127 | <execute_command> |
127 | | - <command>gh pr reviews [PR_NUMBER] --repo [owner]/[repo]</command> |
| 128 | + <command>gh api repos/[owner]/[repo]/pulls/[PR_NUMBER]/reviews</command> |
128 | 129 | </execute_command> |
129 | 130 |
|
130 | 131 | Create a mental or written list of: |
|
372 | 373 | <step number="11"> |
373 | 374 | <name>Submit Review</name> |
374 | 375 | <instructions> |
375 | | - Based on user preference, submit the review using GitHub CLI: |
| 376 | + Based on user preference, submit the review using the GitHub API to support inline comments: |
376 | 377 |
|
377 | | - Note: The GitHub CLI has limited support for creating reviews with inline comments. |
378 | | - For comprehensive reviews with line-specific comments, we'll need to: |
| 378 | + 1. Construct the review payload with inline comments. For each comment, you need: |
| 379 | + - The file path (relative to repository root) |
| 380 | + - The line number where the comment should appear |
| 381 | + - The comment body text |
| 382 | + - The side ("RIGHT" for new code, "LEFT" for old code) |
379 | 383 |
|
380 | | - 1. Create individual comments on specific lines (if needed): |
| 384 | + 2. Submit the review using the GitHub API with heredoc syntax: |
381 | 385 | <execute_command> |
382 | | - <command>gh pr comment [PR_NUMBER] --repo [owner]/[repo] --body "[comment text]"</command> |
| 386 | + <command>gh api -X POST repos/[owner]/[repo]/pulls/[PR_NUMBER]/reviews --input - <<EOF |
| 387 | +{ |
| 388 | + "commit_id": "[headRefOid from Step 2]", |
| 389 | + "body": "Thank you for your contribution! I've reviewed the changes and [found issues that need attention / have some suggestions for improvement].", |
| 390 | + "event": "[COMMENT|REQUEST_CHANGES|APPROVE]", |
| 391 | + "comments": [ |
| 392 | + { |
| 393 | + "path": "[file/path/to/code.ts]", |
| 394 | + "body": "[Your comment text here - use friendly, curious tone]", |
| 395 | + "line": [line_number], |
| 396 | + "side": "RIGHT" |
| 397 | + } |
| 398 | + ] |
| 399 | +} |
| 400 | +EOF</command> |
383 | 401 | </execute_command> |
384 | 402 |
|
385 | | - 2. Or create a general review comment summarizing all findings: |
| 403 | + The review will be created with all inline comments attached to specific lines of code. |
| 404 | + |
| 405 | + Note on event types: |
| 406 | + - "COMMENT": Submit general feedback without approval/rejection |
| 407 | + - "REQUEST_CHANGES": Request changes be made before merging |
| 408 | + - "APPROVE": Approve the PR for merging |
| 409 | + |
| 410 | + Example for a review requesting changes: |
386 | 411 | <execute_command> |
387 | | - <command>gh pr review [PR_NUMBER] --repo [owner]/[repo] --comment --body "[review summary with all findings]"</command> |
| 412 | + <command>gh api -X POST repos/RooCodeInc/Roo-Code/pulls/6378/reviews --input - <<EOF |
| 413 | +{ |
| 414 | + "commit_id": "abc123def4567890...", |
| 415 | + "body": "Thank you for your contribution! I've reviewed the changes and found that the critical issues from the previous review are still pending. I've left some suggestions inline to help improve the implementation.", |
| 416 | + "event": "REQUEST_CHANGES", |
| 417 | + "comments": [ |
| 418 | + { |
| 419 | + "path": "packages/cloud/src/CloudService.ts", |
| 420 | + "body": "Missing error handling here...", |
| 421 | + "line": 19, |
| 422 | + "side": "RIGHT" |
| 423 | + }, |
| 424 | + { |
| 425 | + "path": "packages/cloud/src/CloudService.ts", |
| 426 | + "body": "Is this intentional? The timeout seems quite high (30s). Could we consider reducing it or making it configurable?", |
| 427 | + "line": 45, |
| 428 | + "side": "RIGHT" |
| 429 | + } |
| 430 | + ] |
| 431 | +} |
| 432 | +EOF</command> |
388 | 433 | </execute_command> |
389 | 434 |
|
390 | | - Note: For line-specific comments, you may need to use the GitHub web interface or API directly, |
391 | | - as the gh CLI has limited support for inline review comments. |
392 | | - |
393 | 435 | <update_todo_list> |
394 | 436 | <todos> |
395 | 437 | [x] Fetch pull request information |
|
0 commit comments