github pr stats
- Repo stars 0
- Author repo skills-registry
- Domain
- Data
- Author-declared agents
- No explicit declaration found; this is not inferred or tested compatibility
- Static check
- 88 / 100 · heuristic scan, not runtime safety proof
- Runtime evidence
- Not run; no isolated runtime test evidence is currently recorded
- Author / version / license
- @tomevault-io · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- Python
- Detected file/system behavior
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- None (reference only)
Heads up: Tool permissions are not declared; actual access depends on the runtime.
# GitHub PR Statistics
## Overview
After fetching PR data from the GitHub API, use Python or jq to compute:
- Total PR count
- Merged vs closed counts
- Average time-to-merge (days)
- Top contributor by PR count
## Fetching PRs for a Date Range
```bash
# Using gh search (handles pagination, date filtering)
gh pr list -R cli/cli \
--search "created:2024-12-01..2024-12-31" \
--state all \
--limit 500 \
--json number,author,createdAt,mergedAt,closedAt,state
```
## Python: Compute Stats from JSON
```python
import json
from datetime import datetime, timezone
from collections import Counter
# Load PR data (from gh pr list --json output)
with open('prs.json') as f:
prs = json.load(f)
total = len(prs)
# Count merged vs closed-but-not-merged
merged = [pr for pr in prs if pr['mergedAt']]
closed = [pr for pr in prs if not pr['mergedAt'] and pr['state'] == 'CLOSED']
# Average time to merge (creation -> mergedAt), in days
def parse_dt(s):
return datetime.fromisoformat(s.replace('Z', '+00:00'))
merge_days = []
for pr in merged:
created = parse_dt(pr['createdAt'])
merged_at = parse_dt(pr['mergedAt'])
delta = (merged_at - created).total_seconds() / 86400
merge_days.append(delta)
avg_merge_days = round(sum(merge_days) / len(merge_days), 1) if merge_days else 0.0
# Top contributor
authors = Counter(pr['author']['login'] for pr in prs)
top_contributor = authors.most_common(1)[0][0]
print(json.dumps({
"total": total,
"merged": len(merged),
"closed": len(closed),
"avg_merge_days": avg_merge_days,
"top_contributor": top_contributor
}, indent=2))
```
## Notes on State Values
- `gh pr list --json` returns `state` as `"OPEN"`, `"CLOSED"`, or `"MERGED"`
- `mergedAt` is non-null only for merged PRs
- A PR with `state == "CLOSED"` and `mergedAt == null` is truly closed (not merged)
## Notes on the Search API
- `created:2024-12-01..2024-12-31` is inclusive on both ends
- Dec 31 means up to `2024-12-31T23:59:59Z`
- Use `--limit 500` to avoid truncation for active repos
---
> Source: [cxcscmu/SkillLearnBench](https://github.com/cxcscmu/SkillLearnBench) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
Sections and files
Listed in source order.
sections -> Overview → Fetching PRs for a Date Range → Python: Compute Stats from JSON → Notes on State Values → Notes on the Search API
terms -> --- > Source: [cxcscmu/SkillLearnBench](https://github.com/cxcscmu/SkillLearnBench) — distributed by [TomeVault](https://tomevault.io).
files/cmd -> gh pr list --json · state · "OPEN" · "CLOSED" · "MERGED" · mergedAt · state == "CLOSED" · mergedAt == null
body sha256 -> 8ccfebd8b45d
Overview
After fetching PR data from the GitHub API, use Python or jq to compute: Total PR count Merged vs closed counts Average time-to-merge (days) Top contributor by PR count
Notes on State Values
gh pr list --jsonreturnsstateas"OPEN","CLOSED", or"MERGED"mergedAtis non-null only for merged PRs A PR withstate == "CLOSED"andmergedAt == nullis truly closed (not merged)Notes on the Search API
created:2024-12-01..2024-12-31is inclusive on both ends Dec 31 means up to2024-12-31T23:59:59ZUse--limit 500to avoid truncation for active repos Source: cxcscmu/SkillLearnBench — distributed by TomeVault.