Skip to content

psrna/pr-review-cycle-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PR Review Cycle Time Analyzer

A Node.js tool to analyze pull request review cycle times from GitHub repositories. This tool helps teams understand their code review processes and identify bottlenecks in their development workflow.

Features

  • 📊 Analyze PR review cycle times across repositories
  • 📈 Generate detailed metrics and reports
  • 📋 Export data to CSV for further analysis
  • 🎯 Filter by date ranges, authors, and reviewers
  • 📦 CLI interface for easy integration

Installation

  1. Clone this repository:
git clone <your-repo-url>
cd pr-review-cycle-time
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your GitHub token and settings

Configuration

Create a .env file with the following variables:

GITHUB_TOKEN=your_github_personal_access_token
GITHUB_ORG=your_organization_name
GITHUB_REPO=your_repository_name

Getting a GitHub Token

  1. Go to GitHub Settings > Developer settings > Personal access tokens
  2. Generate a new token with repo scope
  3. Copy the token to your .env file

Usage

Basic Usage

# Analyze PRs from the last 30 days
npm start

# Analyze specific repository
npm start -- --repo owner/repository

# Analyze specific date range
npm start -- --from 2024-01-01 --to 2024-01-31

# Export to CSV
npm start -- --export data/pr-metrics.csv

CLI Options

  • --repo <owner/repo>: Target repository (default: from .env)
  • --from <date>: Start date (YYYY-MM-DD format)
  • --to <date>: End date (YYYY-MM-DD format)
  • --export <file>: Export results to CSV file
  • --help: Show help information

Metrics Calculated

  • Time to First Review: Time from PR creation to first review
  • Time to Approval: Time from PR creation to approval
  • Time to Merge: Time from PR creation to merge
  • Review Cycles: Number of review rounds
  • Contributors: Number of unique reviewers

Project Structure

├── src/
│   └── index.js          # Main CLI application
├── lib/
│   ├── github-client.js  # GitHub API wrapper
│   └── pr-analyzer.js    # PR analysis logic
├── config/
│   └── default.js        # Configuration defaults
├── data/                 # Output directory for exports
└── README.md

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published