Skip to content

About

Ruby script to generate performance review summaries from GitHub PRs using Claude API

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Performance Review PR Summary Generator

A Ruby script that generates a performance review summary by analyzing your GitHub PRs across all Artsy repositories. Uses Claude API to intelligently group related PRs into projects and themes.

Features

  • Fetches all your PRs from Artsy org repos over the last 6 months
  • Uses Claude API to intelligently bucket related PRs into projects
  • Generates a clean markdown report with statistics
  • Caches PR data to avoid re-fetching (cache valid for 24 hours)
  • Includes retry logic and graceful degradation

Prerequisites

  • Ruby (built-in on macOS)
  • gh CLI installed and authenticated
  • Claude API key from Anthropic

Setup

  1. Get your Claude API key from https://console.anthropic.com/
  2. Export it as an environment variable:
export ANTHROPIC_API_KEY="sk-ant-..."

Usage

Basic Usage

ANTHROPIC_API_KEY="sk-ant-..." GITHUB_USERNAME="..." ./pr_performance_review.rb

Custom Configuration

You can customize the script with environment variables:

# Change GitHub username
export GITHUB_USERNAME="your-username"

# Change time period in months (default: 6)
export MONTHS_BACK=12

# Change organization (default: artsy)
export GITHUB_ORG="your-org"

./pr_performance_review.rb

Output

The script generates:

  • performance_review_YYYYMMDD.md - Main markdown report
  • pr_cache.json - Cached PR data (valid for 24 hours)
  • error_log.txt - Error log (if any errors occur)

Report Structure

The markdown report includes:

  1. Summary Statistics - Total PRs, merged, open, repos, projects
  2. Major Projects - High impact projects with grouped PRs
  3. Additional Initiatives - Medium impact work
  4. Miscellaneous Contributions - One-off fixes and improvements
  5. Technical Breakdown - PR counts by repository

How It Works

  1. Fetch Data: Uses gh CLI to fetch all your PRs from Artsy repos
  2. Cache: Saves PR data to avoid re-fetching (24 hour cache)
  3. Analyze: Sends PR data to Claude API for intelligent grouping
  4. Generate: Creates a formatted markdown report

Caching

  • PR data is cached for 24 hours in pr_cache.json
  • To force a refresh, delete the cache file before running
  • The script will tell you if it's using cached data

Error Handling

The script includes robust error handling:

  • Missing API key → exits with clear message
  • GitHub API errors → skips failed repos, continues
  • Claude API errors → retries 3 times, falls back to simple grouping
  • All errors logged to error_log.txt

Example Output

# Performance Review Summary
**Period**: July 2025 - January 2026 (6 months)
**Engineer**: mattzikherman

## Summary Statistics
- **Total PRs**: 109
- **Merged**: 100
- **Repositories**: 12
- **Projects**: 9

## Major Projects

### 1. Message Templates Feature
**Impact**: High | **Repos**: force, gravity, metaphysics | **PRs**: 8

Implementation of a comprehensive message template system...

**Pull Requests:**
- ✓ [force#1234] Add message template UI - https://github.com/...
- ✓ [gravity#5678] API endpoints - https://github.com/...
...

Troubleshooting

"ANTHROPIC_API_KEY environment variable is required"

Make sure you've exported your API key:

export ANTHROPIC_API_KEY="sk-ant-..."

"No PRs found"

  • Check that your GitHub username is correct
  • Verify you have PRs in the specified time period
  • Make sure gh CLI is authenticated: gh auth status

Script hangs or times out

  • Check your internet connection
  • Claude API may be experiencing issues
  • Try running with a smaller time period: export MONTHS_BACK=3

Performance

Expected runtime:

  • ~30-60 seconds to fetch PRs (100 PRs across 20 repos)
  • ~15-30 seconds for Claude API analysis
  • Total: ~1-2 minutes

Future Enhancements

Potential v2 features:

  • Interactive mode to adjust groupings
  • HTML/PDF output formats
  • Comparison to previous periods
  • Automated monthly generation via GitHub Actions

About

Ruby script to generate performance review summaries from GitHub PRs using Claude API

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages