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', ];