github-fetch
A Rust library for fetching GitHub issues, pull requests, discussions, reviews, and diff information via the GitHub API.
Features
- Fetch issues and pull requests with flexible filtering
- Fetch PR reviews (approved, changes requested, etc.)
- Fetch PR review comments (inline comments on diff)
- Fetch PR file changes with diff/patch content
- Fetch GitHub Discussions via GraphQL API
- Rate limiting and retry support
- Builder pattern for configuration
Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
= "1.0"
Authentication
Set your GitHub token as an environment variable:
Quick Start
use ;
async
Usage
Builder Pattern
use GitHubFetcherBuilder;
let fetcher = new
.token
.user_agent
.rate_limit
.max_retries
.build?;
Fetching Issues with Filters
use ;
let filters = IssueFilters ;
let result = fetcher.fetch_issues_with_limit.await?;
Fetching PR Reviews
let reviews = fetcher.fetch_pr_reviews.await?;
for review in &reviews
Fetching PR Review Comments (Inline Diff Comments)
let review_comments = fetcher.fetch_pr_review_comments.await?;
for comment in &review_comments
Fetching PR File Changes (Diff)
let files = fetcher.fetch_pr_files.await?;
for file in &files
Fetching Discussions
let discussion = fetcher.fetch_discussion.await?;
println!;
// Or fetch by URL
let discussion = fetcher.fetch_discussion_by_url.await?;
Data Structures
PrReview
PrReviewComment
PrFile
Examples
Error Handling
use ;
match fetcher.fetch_issue.await
Claude Code Skill
This project includes a Claude Code Skill for PR review and fixing. The skill automatically fetches PR information, analyzes review comments, fixes code issues, and re-reviews changes.
What the Skill Does
- Fetch PR Data - Gets PR details, file diffs, reviews, and inline comments
- Analyze Reviews - Summarizes APPROVED/CHANGES_REQUESTED status and action items
- Fix Issues - Applies fixes based on review feedback
- Re-review - Verifies fixes and checks for new issues
Installation
Option 1: Install as Claude Code Plugin (Recommended)
Option 2: Copy Skill Manually
# Global (available in all projects)
# Project-level (available in current project, can be committed to git)
Option 3: Download Plugin ZIP
Download github-fetch-plugin.zip from releases and extract to your skills directory.
Usage
After installation, just ask Claude naturally:
Review PR https://github.com/tokio-rs/axum/pull/2865
Analyze the review comments on owner/repo#123 and fix the issues
What changes are requested in this PR? https://github.com/owner/repo/pull/456
Example Session
You: Review PR https://github.com/owner/repo/pull/123
Claude:
## PR #123: Fix authentication bug
**Author:** @developer | **State:** Open
### Reviews
| Reviewer | State | Comment |
|----------|-------|---------|
| @reviewer1 | CHANGES_REQUESTED | Please add error handling |
| @reviewer2 | COMMENTED | Consider using Result type |
### Files Changed (2 files, +45 -12)
- `src/auth.rs` (+30 -10) Modified
- `src/lib.rs` (+15 -2) Modified
### Review Comments
#### src/auth.rs:42
> @reviewer1: This should handle the None case
### Action Items
1. [ ] Handle None case in authenticate() (src/auth.rs:42)
2. [ ] Add Result return type (src/auth.rs:45)
Would you like me to fix these issues?
You: Yes, fix them
Claude: [Reads files, applies fixes, re-reviews...]
All issues have been fixed:
- Added match expression for Option handling
- Changed return type to Result<(), AuthError>
Re-reviewing... No new issues found.
Requirements
GITHUB_TOKENenvironment variable must be set- For fixing code: the repository must be cloned locally
Skill Files
skills/pr-review/
├── SKILL.md # Main instructions for Claude
├── WORKFLOW.md # Detailed workflow reference
└── scripts/
└── fetch_pr.rs # Example fetch script
License
MIT OR Apache-2.0