From 606363c416ba93e8752954b8423705f2820732fa Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Sun, 7 Jun 2026 22:03:48 -0400 Subject: [PATCH] =?UTF-8?q?chore(#846):=20remove=20unused=20PR-size=20labe?= =?UTF-8?q?ler=20(size/S=E2=80=93XL)=20workflow=20(#848)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PR Gate workflow's only job, size-check, labeled every PR with size/S–size/XL based on lines changed. Those labels aren't used in any review, triage, or automation flow, so the workflow was pure noise. - Delete .github/workflows/pr-gate.yml - Drop size-check from required status checks in both rulesets so PRs don't block forever on a check that never reports - Remove pr-gate.yml from INERT_WORKFLOWS (ci-test-scope.cjs) and the knownInert list (ci-test-scope.test.cjs) - Remove "PR Gate / size-check" from setup-branch-protection.sh Closes #846 Co-authored-by: Claude Opus 4.8 --- .github/rulesets/main-protection.json | 1 - .github/rulesets/release-branches.json | 1 - .github/workflows/pr-gate.yml | 71 -------------------------- scripts/ci-test-scope.cjs | 1 - scripts/setup-branch-protection.sh | 2 - tests/ci-test-scope.test.cjs | 2 +- 6 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 .github/workflows/pr-gate.yml diff --git a/.github/rulesets/main-protection.json b/.github/rulesets/main-protection.json index 00d41cbfd..73f78055a 100644 --- a/.github/rulesets/main-protection.json +++ b/.github/rulesets/main-protection.json @@ -35,7 +35,6 @@ "strict_required_status_checks_policy": true, "required_status_checks": [ { "context": "Required tests" }, - { "context": "size-check" }, { "context": "check-branch" }, { "context": "changeset-lint" }, { "context": "docs-lint" }, diff --git a/.github/rulesets/release-branches.json b/.github/rulesets/release-branches.json index 28e0b24de..182befe49 100644 --- a/.github/rulesets/release-branches.json +++ b/.github/rulesets/release-branches.json @@ -32,7 +32,6 @@ "strict_required_status_checks_policy": true, "required_status_checks": [ { "context": "Required tests" }, - { "context": "size-check" }, { "context": "check-branch" }, { "context": "changeset-lint" }, { "context": "docs-lint" }, diff --git a/.github/workflows/pr-gate.yml b/.github/workflows/pr-gate.yml deleted file mode 100644 index e1415bb03..000000000 --- a/.github/workflows/pr-gate.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: PR Gate - -on: - pull_request: - types: [opened, synchronize] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - pull-requests: write - issues: write - -jobs: - size-check: - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - - - name: Check PR size - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - script: | - const files = await github.paginate(github.rest.pulls.listFiles, { - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - per_page: 100, - }); - - const additions = files.reduce((sum, f) => sum + f.additions, 0); - const deletions = files.reduce((sum, f) => sum + f.deletions, 0); - const total = additions + deletions; - - let label = ''; - if (total <= 50) label = 'size/S'; - else if (total <= 200) label = 'size/M'; - else if (total <= 500) label = 'size/L'; - else label = 'size/XL'; - - // Remove existing size labels - const existingLabels = context.payload.pull_request.labels || []; - const sizeLabels = existingLabels.filter(l => l.name.startsWith('size/')); - for (const staleLabel of sizeLabels) { - await github.rest.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - name: staleLabel.name - }).catch(() => {}); // ignore if already removed - } - - // Add size label - try { - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - labels: [label], - }); - } catch (e) { - core.warning(`Could not add label: ${e.message}`); - } - - if (total > 500) { - core.warning(`Large PR: ${total} lines changed (${additions}+ / ${deletions}-). Consider splitting.`); - } diff --git a/scripts/ci-test-scope.cjs b/scripts/ci-test-scope.cjs index 3e9435e6b..c90ffb485 100644 --- a/scripts/ci-test-scope.cjs +++ b/scripts/ci-test-scope.cjs @@ -20,7 +20,6 @@ const INERT_WORKFLOWS = new Set([ 'auto-backmerge.yml', 'close-draft-prs.yml', 'dismiss-unauthorized-pr-approvals.yml', - 'pr-gate.yml', 'pr-target-validator.yml', 'pr-template-format.yml', 'require-issue-link.yml', diff --git a/scripts/setup-branch-protection.sh b/scripts/setup-branch-protection.sh index e186ae4ce..f7619e4e7 100755 --- a/scripts/setup-branch-protection.sh +++ b/scripts/setup-branch-protection.sh @@ -61,13 +61,11 @@ REQUIRED_CHECKS_MAIN=( "security-scan" "Changeset Required / changeset-lint" "Docs Required / docs-lint" - "PR Gate / size-check" "Validate Branch Name / check-branch" ) REQUIRED_CHECKS_NEXT=( "test" - "PR Gate / size-check" "Validate Branch Name / check-branch" "Changeset Required / changeset-lint" "Docs Required / docs-lint" diff --git a/tests/ci-test-scope.test.cjs b/tests/ci-test-scope.test.cjs index d6d456028..08c67f723 100644 --- a/tests/ci-test-scope.test.cjs +++ b/tests/ci-test-scope.test.cjs @@ -343,7 +343,7 @@ describe('INERT_WORKFLOWS allowlist integrity guard', () => { const knownInert = [ 'stale.yml', 'branch-cleanup.yml', 'branch-naming.yml', 'auto-label-issues.yml', 'auto-branch.yml', 'auto-backmerge.yml', 'close-draft-prs.yml', - 'dismiss-unauthorized-pr-approvals.yml', 'pr-gate.yml', 'pr-target-validator.yml', + 'dismiss-unauthorized-pr-approvals.yml', 'pr-target-validator.yml', 'pr-template-format.yml', 'require-issue-link.yml', 'changeset-required.yml', 'docs-required.yml', 'discord-changelog.yml', ];