fetch-pr-comments
/fetch-pr-comments
Fetch new review comments from a GitHub PR, filtered to trusted users (org members + allowed bots). Use when monitoring a PR for feedback, checking for new review comments, or building a review-response workflow.
- Author
- openshift-eng ↗
- Repository
- ai-helpers ↗
- Licence
- Apache-2.0
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: fetch_pr_comments.sh
What it does and when to use it
Fetch new review comments from a GitHub PR, filtered to trusted users (org members + allowed bots). Use when monitoring a PR for feedback, checking for new review comments, or building a review-response workflow.
Original author description
Fetch new review comments from a GitHub PR, filtered to trusted users (org members + allowed bots). Use when monitoring a PR for feedback, checking for new review comments, or building a review-response workflow.
How it works
- When to Use This Skill
- Prerequisites
- Implementation
- How It Works
- Trust Model
- See Also
SKILL.md preview
---
name: fetch-pr-comments
description: Fetch new review comments from a GitHub PR, filtered to trusted users (org members + allowed bots). Use when monitoring a PR for feedback, checking for new review comments, or building a review-response workflow.
---
# Fetch PR Comments
Fetch all comments from a GitHub pull request, filtered to trusted users only. Trusted users are GitHub org members and explicitly allowed bots. Untrusted comments are silently excluded.
This skill fetches from all three GitHub comment endpoints (inline review comments, review summaries, and PR conversation comments), providing a complete picture of PR feedback.
## When to Use This Skill
Use this skill when you need to:
- Check a PR for new review comments that need attention
- Monitor a PR for feedback during an agentic workflow
- Build a review-response loop that only processes trusted feedback
- Fetch all actionable PR comments in a single call
## Prerequisites
1. **`gh` CLI**: Authenticated with `gh auth login`
2. **Repository read access**: The token must have permission to read PR comments and check org membership
## Implementation
### Basic usage
```bash
result=$(bash "${CLAUDE_PLUGIN_ROOT}/skills/fetch-pr-comments/fetch_pr_comments.sh" \
--repo owner/repo \
--pr 123)
```
### With custom trusted bots and exclusions
```bash
result=$(bash "${CLAUDE_PLUGIN_ROOT}/skills/fetch-pr-comments/fetch_pr_comments.sh" \
--repo owner/repo \
--pr 123 \
--trusted-bots "coderabbitai,dependabot" \
--exclude-ids "12345,67890")
```
### Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--repo` | Yes | GitHub repository in `owner/repo` format |
| `--pr` | Yes | Pull request number |
| `--trusted-bots` | No | Comma-separated bot logins to trust (default: `coderabbitai`) |
| `--exclude-ids` | No | Comma-separated comment IDs to skip (already processed) |
### Output
JSON on stdout:
```json
{
"inline_comments": [
{"id": "123", "user": "reviewer", "path": "pkg/server.go", "body": "This needs a nil check"}
],
"reviews": [
{"id": "456", "user": "reviewer", "state": "CHANGES_REQUESTED", "body": "See inline comments"}
],
"issue_comments": [
{"id": "789", "user": "coderabbitai[bot]", "body": "Static analysis found..."}
],
"all_ids": ["123", "456", "789"],
"total": 3,
"formatted": {
"inline": "**reviewer** on `pkg/server.go`:\nThis needs a nil check\n---",
"reviews": "**reviewer** (CHANGES_REQUESTED):\nSee inline comments\n---",
"issue_comments": "**coderabbitai[bot]**:\nStatic analysis found...\n---"
}
}
```
### Using in a polling loop
The `all_ids` and `--exclude-ids` fields enable stateful polling across iterations:
```bash
PROCESSED_IDS=""
while true; do
sleep 300
result=$(bash "${CLAUDE_PLUGIN_ROOT}/skills/fetch-pr-comments/fetch_pr_comments.sh" \
--repo owner/repo --pr 123 --exclude-ids "$PROCESSED_IDS")
total=$(echo "$result" | jq -r '.total')
if [[ "$total" -gt 0 ]]; then
# Process comments...
new_ids=$(echo "$result" | jq -r '.all_ids | join(",")')
PROCESSED_IDS="${PROCESSED_IDS:+$PROCESSED_IDS,}$new_ids"
fi
done
```
### Using formatted output for Claude prompts
The `formatted` fields provide ready-to-use text:
```bash
inline=$(echo "$result" | jq -r '.formatted.inline')
reviews=$(echo "$result" | jq -r '.formatted.reviews')
issue_comments=$(echo "$result" | jq -r '.formatted.issue_comments')
```
## How It Works
1. Fetches from three GitHub API endpoints:
- `repos/{repo}/pulls/{pr}/comments` — inline code review comments
- `repos/{repo}/pulls/{pr}/reviews` — review summaries (CHANGES_REQUESTED, etc.)
- `repos/{repo}/issues/{pr}/comments` — PR conversation thread
2. Identifies all unique comment authors
3. Checks each author against the trusted bots list and org membership (`gh api orgs/{org}/members/{login}`)
4. Filters comments to trusted authors only
5. Excludes already-processed comment IDs
6. Filters out APPROVED and PENDING reviews (no actionable content)
7. Returns structured JSON with both raw data and pre-formatted text
## Trust Model
A user is trusted if they match ANY of:
- Their login matches a `--trusted-bots` entry (with or without `[bot]` suffix)
- They are a member of the repository's GitHub organization
All other commenters are silently excluded.
## See Also
- Related Skill: `check-pr-ci-status` — Check CI status and detect new failures
- Related Skill: `upload-screenshot` — Upload images to GitHub for PR comments
- Related Command: `/utils:address-reviews` — Full review-addressing workflow
Files in this package (2)
- SKILL.md 5 KB
- fetch_pr_comments.sh 5 KB
Versions
The database has no other skills named fetch-pr-comments.
Database snapshot: 13.11.2026 · package version 03d07dd57351 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100fix-review
When the user asks to fix, address, or work on PR review comments — fetch review comments from a GitHub pull request and apply fixes to the local codebase. Requires gh CLI. - 100review-pr-comments
Address review comments on a GitHub pull request — fetch unresolved comments, investigate each issue, fix valid ones, reply, and resolve threads. Use this skill when the user asks to review PR comments, address PR feedback, handle PR review, respond to reviewer comments, or fix… - 90github:pr-comments
Fetch, reply to, and resolve review threads on a GitHub pull request. Use when checking what review feedback needs addressing, whether threads are resolved, replying to review comments, or clearing AI-reviewer threads after acting on them. - 90address-review
Fetch GitHub PR review comments, triage them into must-fix/discuss/optional/skipped, and guide fixing or replying to selected feedback. Use when addressing PR review comments or review threads. - 84reply
This skill should be used when the user asks to "reply to PR comments", "respond to review comments", "reply to PR #123", "answer PR feedback", or wants to respond to unresolved review threads or comments from other users on a pull request. - 100github-pr-comments
Resolve inline code review comments on a GitHub PR. Use when asked to "resolve review comments", "address PR feedback", "fix PR comments", or "work through review comments". Fetches every inline comment with its surrounding code context, then applies each change systematically.