ci: auto-label PRs by size via cbrgm/pr-size-labeler-action (#1101)

Adds a GitHub Actions workflow and config that labels every PR with
size/xs..size/xl based on files changed and lines added, so reviewers
can see at a glance how big a PR is. Lock files and generated/vendored
paths are excluded, and deletions aren't counted so refactors that
remove code aren't over-penalized.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Neil 2026-04-25 17:20:42 -07:00 committed by GitHub
parent 39364f975f
commit b96dc93d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 0 deletions

50
.github/pull-request-size.yml vendored Normal file
View File

@ -0,0 +1,50 @@
# Configuration for cbrgm/pr-size-labeler-action
# See: https://github.com/cbrgm/pr-size-labeler-action
#
# A PR gets the smallest label whose `diff` and `files` thresholds both fit.
# Generated/lock/vendored files are excluded so they don't dominate the size calculation.
exclude_files:
- "**/pnpm-lock.yaml"
- "**/package-lock.json"
- "**/yarn.lock"
- "**/*.lock"
- "**/*.snap"
- "**/dist/**"
- "**/build/**"
- "**/node_modules/**"
- "**/vendor/**"
- "**/*.min.js"
- "**/*.min.css"
- "**/*.map"
- "**/*.generated.*"
- "**/generated/**"
label_configs:
- size: xs
diff: 25
files: 1
labels: ["size/xs"]
- size: s
diff: 150
files: 10
labels: ["size/s"]
- size: m
diff: 600
files: 25
labels: ["size/m"]
- size: l
diff: 2500
files: 50
labels: ["size/l"]
- size: xl
diff: 5000
files: 100
labels: ["size/xl"]
# Count only added lines (ignore deletions) so large refactors/removals aren't over-penalized.
added_lines_only: true

29
.github/workflows/pr-size-labeler.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: PR Size Labeler
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
permissions:
pull-requests: write
contents: read
jobs:
label-pr-size:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Label PR based on size
uses: cbrgm/pr-size-labeler-action@v1.3.7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repository: ${{ github.repository }}
github_pr_number: ${{ github.event.pull_request.number }}
config_file_path: .github/pull-request-size.yml