PR Size Detection

The Problem

The 3,000-line PR.

We’ve all seen it. No one wants to review it. It sits for days. Then gets approved with a “LGTM 👍” because everyone’s too busy to actually read it.

This is how technical debt accumulates and bugs slip through.

The Solution

lazyPR calculates PR size and warns (or blocks) based on configurable thresholds.

Default thresholds:

  • Warning at 500 lines - “Consider splitting this PR”
  • Block at 2,000 lines - “Too large to summarize effectively”

Both are fully configurable or can be disabled entirely.


Usage

Configure size thresholds in your workflow:

- uses: elvis-ndubuisi/lazypr@v1
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    api_key: ${{ secrets.OPENAI_API_KEY }}
    pr_size_warning: "500"   # Warn if exceeded (0 to disable)
    pr_size_block: "2000"    # Block if exceeded (0 to disable)

Configuration Options

pr_size_warning (optional, default: 500)

  • Shows a warning when PR exceeds this many lines
  • Set to 0 to disable warnings

pr_size_block (optional, default: 2000)

  • Blocks summarization when PR exceeds this many lines
  • Set to 0 to disable blocking

Size Metrics

lazyPR tracks:

MetricDescription
Total LinesAdditions + deletions
Files ChangedNumber of modified files
AdditionsNew lines of code
DeletionsRemoved lines of code

Example output:

⚠️ PR Size Warning: 850 lines changed (exceeds 500 line threshold by 70%)

Consider splitting this PR into smaller, more focused changes for better review.

Template Integration

Access size metrics in custom templates:

### 📊 PR Size
- **Total:** {{prSizeLines}} lines
- **Files:** {{prSizeFiles}} changed
- **Additions:** {{prSizeAdditions}}
- **Deletions:** {{prSizeDeletions}}

{{prSizeMetrics}}

Available placeholders:

  • {{prSizeLines}} - Total lines changed
  • {{prSizeFiles}} - Files changed count
  • {{prSizeAdditions}} - Lines added
  • {{prSizeDeletions}} - Lines removed
  • {{prSizeMetrics}} - Formatted size summary

Key Benefits

  • Visibility - Authors see size impact immediately
  • Review quality - Smaller PRs get reviewed faster and better
  • Gentle enforcement - Configurable warnings vs. hard blocks
  • Team standards - Drive better PR hygiene through automation

Best Practices

Recommended thresholds:

  • 500 lines - Good for most teams (warning)
  • 1,000 lines - Conservative approach
  • 2,000 lines - Maximum before review quality degrades

When to disable:

  • Initial project setup
  • Large refactoring efforts
  • Automated dependency updates

Small PRs, better reviews. See user guide for more quality features.