ci: label PRs by size without counting tests
Merged
OK
19d ago+204+204+012345678901234567890123456789-0-0-0123456789
What and why
- Every PR gets one
size:XS..size:XXLlabel (<10, <30, <100, <500, <1000, 1000+ lines), updated on each push. Lets reviewers see how big a PR is from the PR list. - Counts added plus deleted lines from the PR's file list, without
*.test.*,*.spec.*,*.e2e.*,tests/,tests-*/,__tests__/,*-snapshots/,__snapshots__/,fixtures/,pnpm-lock.yaml. A PR touching only those is sized by all its lines. - Same shape as
pr-policy:pull_request_targetso fork PRs can be labeled, sparse checkout of the base branch'sscripts/pr-sizeonly,fetchwithGITHUB_TOKEN. Never checks out or runs PR code.--dry-runprints the size and writes nothing. - Rules in
scripts/pr-size/size.ts, API calls inscripts/pr-size/label.ts. Labels get created with colors the first time they're used. - Idea from T3 Code's
pr-size.yml.
Verified
Ran it locally: yes
node scripts/pr-size/label.ts --dry-runagainst the last 10 PRs here:
| PR | GitHub +/- | counted / total | label |
|---|---|---|---|
| #1418 | +57/-0 | 57 / 57 | size:M |
| #1417 test-only | +240/-0 | 0 / 240 | size:L |
| #1416 | +262/-21 | 104 / 283 | size:L |
| #1413 | +159/-28 | 84 / 187 | size:M |
| #1412 | +1467/-15 | 1321 / 1482 | size:XXL |
| #1411 | +794/-10 | 804 / 804 | size:XL |
| #1410 | +357/-21 | 77 / 378 | size:M |
| #1408 | +265/-9986 | 1812 / 10251 | size:XXL |
| #1407 | +454/-6 | 160 / 460 | size:L |
| #1401 | +231/-18 | 117 / 249 | size:L |
- The workflow itself has not run.
pull_request_targetuses the base branch copy, so it starts working after merge and won't label this PR.
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.