Problem
Large PRs are slow and lead to shallow reviews. We want a nudge toward smaller,
targeted PRs without blocking anyone.
Proposal
A GitHub Actions workflow that measures each PR and applies an
Oversized PR label when it is over budget.
- Budget: 250 changed lines (additions + deletions)
- Counts only
.ts, .tsx, .js, .jsx (and .mts, .cts, .mjs, .cjs)
- Skips brand-new files, so a new test or module is free
- Skips the auto-generated asset index files
- Adds a sticky comment listing the largest files
- Removes the label and comment once the PR shrinks under budget
- Advisory only: the check never fails, so nothing is blocked
How it works
.github/workflows/pr-size.yml runs on pull_request_target so fork PRs can be labeled
.github/scripts/pr-size.ts does the work through the GitHub REST API
- The PR's code is never checked out or executed
- Dry run locally:
bun .github/scripts/pr-size.ts <pr-number> --dry-run
Reference
Against recent merged PRs, #194 came in at 134 lines and #195 at 373 lines
in existing files, so #195 would have been labeled.
Open questions
- Is 250 the right budget?
- Should test files be excluded from the count as well?
Problem
Large PRs are slow and lead to shallow reviews. We want a nudge toward smaller,
targeted PRs without blocking anyone.
Proposal
A GitHub Actions workflow that measures each PR and applies an
Oversized PRlabel when it is over budget..ts,.tsx,.js,.jsx(and.mts,.cts,.mjs,.cjs)How it works
.github/workflows/pr-size.ymlruns onpull_request_targetso fork PRs can be labeled.github/scripts/pr-size.tsdoes the work through the GitHub REST APIbun .github/scripts/pr-size.ts <pr-number> --dry-runReference
Against recent merged PRs, #194 came in at 134 lines and #195 at 373 lines
in existing files, so #195 would have been labeled.
Open questions