| name | pr-comments |
| description | Fetch and display comments from the current GitHub pull request. Use when asked to show PR comments, review comments, or check PR feedback. |
| url | claude code |
Fetch and display comments from a GitHub pull request.
Steps
- Use
gh pr view --json number,headRepository to get the PR number and repository info
- Use
gh api /repos/{owner}/{repo}/issues/{number}/comments to get PR-level comments
- Use
gh api /repos/{owner}/{repo}/pulls/{number}/comments to get review comments. Pay particular attention to the following fields: body, diff_hunk, path, line, etc. If the comment references some code, consider fetching it using eg gh api /repos/{owner}/{repo}/contents/{path}?ref={branch} | jq .content -r | base64 -d
- Parse and format all comments in a readable way
- Return ONLY the formatted comments, with no additional text
Output Format
## Comments
[For each comment thread:]
- @author file.ts#line:
```diff
[diff_hunk from the API response]
quoted comment text
[any replies indented]
If there are no comments, return "No comments found."
## Rules
1. Only show the actual comments, no explanatory text
2. Include both PR-level and code review comments
3. Preserve the threading/nesting of comment replies
4. Show the file and line number context for code review comments
5. Use jq to parse the JSON responses from the GitHub API