Run2 github rest api
Query GitHub REST API with pagination and date filtering for repository data (PRs, issues).From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill run2_github-rest-apiAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
2.5 KB, 603 tokens by cl100k_base, as published. Nobody here has run it
GitHub REST API Queries for Repository Analytics
Overview
Use GitHub's REST API directly to query repository data with fine-grained filtering and pagination.
Setup
- Python 3 with
urllib(standard library) - No external dependencies required
- No authentication needed for public repositories (subject to rate limits)
Key Endpoints
Pull Requests
GET /repos/{owner}/{repo}/pulls?state=all&per_page=100&sort=created&direction=desc&page={page}
Issues
GET /repos/{owner}/{repo}/issues?state=all&per_page=100&sort=created&direction=desc&page={page}
Important: PR vs Issue Distinction
The issues endpoint returns both issues AND pull requests. PRs have a pull_request field. To get true issues only, filter out items with "pull_request" not in item.
Date Filtering
The API doesn't support server-side date filtering. Filter client-side by:
created = datetime.fromisoformat(item["created_at"].replace("Z", "+00:00"))
if created.year == 2024 and created.month == 12:
# Process item
Pagination Strategy
- Use
per_page=100for efficiency (max allowed) - Check results to find earliest date per page
- Stop when all items in a page are before your target date range
- Note: Results within pages may not be monotonically ordered across all pages
Date Handling
- GitHub returns UTC timestamps in ISO 8601 format (e.g., "2024-12-15T10:30:45Z")
- Remove 'Z' and replace with '+00:00' for Python's
datetime.fromisoformat() - Compare timezone-aware datetimes only
State Values
state=all: both open and closed itemsstate=open: only openstate=closed: only closed- For PRs only:
state=merged(not standard, use state check in response)
Response Fields
Key fields for analytics:
created_at: ISO 8601 timestampmerged_at: For PRs, null if not mergedclosed_at: When closed (null if open)state: "open", "closed" (for PRs, may be "merged" in older API versions)user.login: Author usernamelabels: Array of{name: string}pull_request: Present only for PRs (when querying issues)
Error Handling
- Implement timeout handling (network delays)
- Check HTTP status codes
- Handle rate limiting (429 status)
- Graceful degradation for network failures
Example Rate Limits
- Unauthenticated: 60 requests/hour
- Authenticated: 5,000 requests/hour
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.