Skip to content

Aswincloud/pr-review-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 PR Approval Finder v7.0

Version License React Node PRs Welcome

A modern web application that analyzes GitHub Pull Requests to determine minimum required approvals based on CODEOWNERS files. Now featuring AI-powered approval predictions that learn from your team's historical patterns.

🚀 Live Demo📖 Documentation👨‍💻 Portfolio🐛 Report Bug💡 Request Feature

✨ Features

🎯 Core Functionality

  • 🔍 Smart CODEOWNERS Analysis - Parses CODEOWNERS files with advanced glob pattern matching
  • 📊 Minimum Approval Calculation - Determines exact number of approvals needed
  • 📁 File-by-File Breakdown - Shows which files require which approvers
  • ⚡ Real-time PR Status - Displays current approval status and progress
  • 👥 Team Integration - GitHub team support with member visualization

🧠 Real Machine Learning Features (NEW!)

  • 🤖 Genuine ML: Uses Random Forest classifier with proper feature engineering
  • 📊 Real Training Data: Learns from actual GitHub PR and approval history
  • 🔍 Smart Features: Analyzes file patterns, developer expertise, and temporal data
  • ✅ Proper Validation: Cross-validation, train/test splits, and AUC scoring
  • 📈 Continuous Learning: Model can be retrained with new data
  • 🚀 Production Ready: Model saving/loading, API integration, and fallback support

🎨 Modern UI/UX

  • 🎭 8 Beautiful Themes - Light, Dark, Ocean, Forest, Sunset, Midnight, Arctic, Cherry
  • 📱 Fully Responsive - Perfect experience on desktop, tablet, and mobile
  • 💫 Smooth Animations - Skeleton loaders, slide effects, and micro-interactions
  • 🌟 Modern Design - Clean UI with backdrop blur and smooth transitions
  • 🎯 Accessibility First - WCAG 2.1 compliant with keyboard navigation

🚀 Advanced Features

  • 📈 Progress Visualization - Animated SVG progress rings with completion stats
  • 📚 PR History - Local storage of recent PRs with quick access
  • 🔀 Basic/Advanced Views - Toggle between simplified and detailed analysis
  • 👥 Team Management - GitHub team integration with member visualization
  • 💬 Feedback System - Built-in feedback form for user suggestions

🔒 Security & Privacy

  • 🛡️ Privacy First - No server storage, all data kept locally
  • 🔐 Optional GitHub Tokens - Works with public repos, supports private with tokens
  • 🚫 No Tracking - No analytics, cookies, or personal data collection
  • 🔒 Secure Communication - HTTPS only with direct GitHub API calls
  • ⚙️ Rate Limit Handling - Smart retry logic with rate limit visualization

🔄 How It Works

Our application follows a simple yet powerful workflow to analyze your Pull Requests:

Application Workflow

CODEOWNERS Analysis Process

Here's how we intelligently group files and determine required approvals:

CODEOWNERS Analysis Process


🚀 Getting Started

Prerequisites

Node.js >= 18.0.0
npm >= 8.0.0

Quick Start

# Clone the repository
git clone https://github.com/Aswin-coder/pr-review-checker.git
cd pr-review-checker

# Install dependencies
npm install

# Start development server
npm run dev

🌐 Open your browser: http://localhost:3000

Alternative Installation Methods

📦 Using Docker
# Build and run with Docker
docker-compose up --build

# Or run individual services
docker run -p 3000:3000 pr-approval-finder
🔧 Manual Setup
# Install dependencies for each service
npm install
cd client && npm install
cd ../server && npm install

# Start services separately
npm run server  # Terminal 1
npm run client  # Terminal 2

📖 Usage

Basic Usage

  1. 📝 Enter GitHub PR URL

    https://github.com/owner/repo/pull/123
    
  2. 🔑 Add GitHub Token (Optional)

    • For private repositories
    • Higher rate limits (5000 vs 60 requests/hour)
    • Team member visibility
  3. 🔍 Analyze & Review

    • View minimum required approvals
    • See detailed file-by-file breakdown
    • Track approval progress in real-time

🧠 Real ML Features Setup

  1. Train the REAL ML Model (NEW!)

    # Install Python dependencies
    python3 -m venv ml-env
    source ml-env/bin/activate
    pip install scikit-learn pandas numpy requests joblib
    
    # Train the model on your repository
    python ml-implementation-starter.py
  2. See Intelligent Predictions

    • Real ML confidence scores (not fake percentages)
    • Based on actual feature engineering and cross-validation
    • Learns from file types, developer expertise, and historical patterns
    • Provides proper confidence intervals
  3. Model Management

    # Test the integration
    node test_real_ml.js
    
    # Check model status
    GET /api/ml/stats
    
    # Make predictions
    POST /api/ml/predict

For detailed ML setup, see docs/ML_CODEOWNERS.md

Advanced Features

🎨 Theme Customization

Choose from 8 professionally designed themes:

  • ☀️ Light - Clean and bright (default)
  • 🌙 Dark - Easy on the eyes
  • 🌊 Ocean - Deep blue vibes
  • 🌲 Forest - Natural green tones
  • 🌅 Sunset - Warm orange hues
  • 🌌 Midnight - Deep purple night
  • ❄️ Arctic - Cool blue-white
  • 🌸 Cherry - Soft pink accents
🔒 Privacy & Security

Our application prioritizes your privacy and security with comprehensive protection:

Security & Privacy Features

Click the 🔒 Privacy and 🛡️ Cloudflare buttons in the app footer to view detailed information about:

  • No Server Storage - All data stays in your browser
  • Local Storage Only - Tokens and history stored locally
  • No Tracking - Zero analytics or data collection
  • Cloudflare Protection - Enterprise-grade security and performance
  • Open Source - Full code transparency
⚙️ Configuration Options

Create .env files for customization:

# Server configuration
GITHUB_TOKEN=your_github_token_here
PORT=3001
NODE_ENV=production

# Client configuration
REACT_APP_API_URL=http://localhost:3001

🏗️ Architecture

Tech Stack

Frontend

  • ⚛️ React 18 with Hooks
  • 🎨 CSS3 with Custom Properties (CSS Variables)
  • 📱 Responsive Design with CSS Grid/Flexbox
  • 🌐 Axios for API requests
  • 🎭 8-theme system with persistence

Backend

  • 🚀 Node.js + Express
  • 🔗 GitHub REST API v3
  • 🔍 Minimatch for glob patterns
  • 🛡️ CORS enabled
  • 📧 Nodemailer for feedback system
  • 🧠 ML Training system with enhanced PR fetching

DevOps

  • 🚀 VPS server for production deployment
  • 📦 npm for package management
  • 🧪 Jest for testing
  • 📝 ESLint + Prettier
  • 🐳 Docker support

Key Components

├── 🎨 Theme System          # CSS variables with persistent storage
├── 💀 Skeleton Loaders      # Beautiful loading animations
├── 📊 Progress Visualization # SVG-based progress rings
├── 📱 Responsive Grid       # CSS Grid for adaptive layouts
├── 🔍 Pattern Matching      # Advanced glob pattern support
├── 🔒 Privacy Modal         # Comprehensive privacy information
├── 💬 Feedback System       # User feedback collection
├── 🧠 ML Training System    # Enhanced PR fetching and duplicate handling
└── 🚀 Performance Optimized # Lazy loading and memoization

🧪 Testing

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

# Run specific test suite
npm run test:client
npm run test:server

Test Coverage

  • ✅ Component testing with React Testing Library
  • ✅ API endpoint testing with Supertest
  • ✅ Integration testing for core workflows
  • ✅ GitHub API mocking for reliable tests

🚀 Deployment

Docker (Recommended for Production)

# Build production image
docker build -t pr-approval-finder .

# Run production container
docker run -p 3000:3000 pr-approval-finder

# Or use docker-compose
docker-compose up --build

VPS Server Deployment

# Build for production
npm run build

# Start production server
npm start

# Or use PM2 for process management
pm2 start server/index.js --name pr-approval-finder

Branch Preview (Vercel)

Note: Vercel is used exclusively for PR branch previews and development testing, not for production deployment.

# Deploy PR preview to Vercel
vercel

# Preview branch deployment
vercel --prod

🤝 Contributing

We love contributions! Please see our Contributing Guide for details.

Development Workflow

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch (git checkout -b feature/amazing-feature)
  3. 🔧 Make your changes
  4. ✅ Run tests (npm test)
  5. 📝 Commit your changes (git commit -m 'Add amazing feature')
  6. 🚀 Push to the branch (git push origin feature/amazing-feature)
  7. 🎯 Open a Pull Request

Code Style

We use Prettier and ESLint to maintain consistent code style:

# Format code
npm run format

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

📊 Performance

  • Optimized Bundle - Tree shaking and code splitting
  • 🚀 Fast Loading - Skeleton loaders for perceived performance
  • 📱 Mobile Optimized - Touch-friendly interface
  • 🔄 Efficient Caching - Smart API response caching
  • 📈 Lightweight - Minimal dependencies

🔧 API Reference

Endpoints

POST /api/pr-approvers
{
  "prUrl": "https://github.com/owner/repo/pull/123",
  "githubToken": "optional_token"
}

POST /api/ml/train
{
  "owner": "repo-owner",
  "repo": "repo-name", 
  "token": "github-token",
  "prCount": 1000
}

POST /api/ml/predict
{
  "files": ["src/file.js"],
  "confidence": 0.3
}

GET /api/ml/status
GET /api/ml/stats
POST /api/ml/clear
POST /api/ml/remove-duplicates

Response Format

{
  "prInfo": {
    "title": "PR Title",
    "number": 123,
    "author": "username",
    "state": "open",
    "url": "https://github.com/owner/repo/pull/123"
  },
  "minRequiredApprovals": [
    {
      "files": ["src/component.js"],
      "ownerDetails": [...],
      "needsApproval": true,
      "approvedBy": null
    }
  ],
  "totalGroupsNeedingApproval": 2,
  "approvals": ["reviewer1"],
  "requestedReviewers": ["reviewer2"],
  "mlPredictions": {
    "predictions": [
      {
        "approver": "developer1",
        "confidence": 0.85
      }
    ]
  },
  "rateLimitInfo": {
    "limit": 5000,
    "remaining": 4999,
    "resetTime": "2025-01-01T12:00:00Z"
  }
}

📞 Support


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • 💝 Built with ❤️ using React and Node.js
  • 🔗 GitHub API for PR and CODEOWNERS data
  • 🎨 Modern CSS techniques for beautiful UI
  • 🔍 Minimatch library for glob pattern matching
  • 🚀 VPS server for production hosting
  • 🔧 Vercel for PR branch previews
  • 🤖 Cursor AI for development assistance

🔍 How It Works

  1. 📥 Input Processing - Validates GitHub PR URL format
  2. 🔗 API Integration - Fetches PR data and CODEOWNERS from GitHub
  3. 🧮 Pattern Matching - Uses minimatch to match files against CODEOWNERS patterns
  4. 👥 Team Resolution - Resolves GitHub teams to individual members
  5. 📊 Analysis - Calculates minimum required approvals based on file changes
  6. 🧠 ML Predictions - Uses trained models to predict approval likelihood
  7. 🎨 Visualization - Presents results with interactive progress indicators

© 2025 AswinPortfolioCrafted with Cursor AI

GitHub stars GitHub forks

⭐ Star this repo if you find it helpful!

About

Web app that analyzes GitHub PRs against CODEOWNERS to compute minimum required approvals, with AI-powered approval predictions from team history

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors