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 <noreply@anthropic.com>
(cherry picked from commit 606363c416)
This commit is contained in:
committed by
github-actions[bot]
parent
7eb4d286c4
commit
ccf2b5624e
1
.github/rulesets/main-protection.json
vendored
1
.github/rulesets/main-protection.json
vendored
@@ -35,7 +35,6 @@
|
|||||||
"strict_required_status_checks_policy": true,
|
"strict_required_status_checks_policy": true,
|
||||||
"required_status_checks": [
|
"required_status_checks": [
|
||||||
{ "context": "Required tests" },
|
{ "context": "Required tests" },
|
||||||
{ "context": "size-check" },
|
|
||||||
{ "context": "check-branch" },
|
{ "context": "check-branch" },
|
||||||
{ "context": "changeset-lint" },
|
{ "context": "changeset-lint" },
|
||||||
{ "context": "docs-lint" },
|
{ "context": "docs-lint" },
|
||||||
|
|||||||
1
.github/rulesets/release-branches.json
vendored
1
.github/rulesets/release-branches.json
vendored
@@ -32,7 +32,6 @@
|
|||||||
"strict_required_status_checks_policy": true,
|
"strict_required_status_checks_policy": true,
|
||||||
"required_status_checks": [
|
"required_status_checks": [
|
||||||
{ "context": "Required tests" },
|
{ "context": "Required tests" },
|
||||||
{ "context": "size-check" },
|
|
||||||
{ "context": "check-branch" },
|
{ "context": "check-branch" },
|
||||||
{ "context": "changeset-lint" },
|
{ "context": "changeset-lint" },
|
||||||
{ "context": "docs-lint" },
|
{ "context": "docs-lint" },
|
||||||
|
|||||||
71
.github/workflows/pr-gate.yml
vendored
71
.github/workflows/pr-gate.yml
vendored
@@ -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.`);
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,6 @@ const INERT_WORKFLOWS = new Set([
|
|||||||
'auto-backmerge.yml',
|
'auto-backmerge.yml',
|
||||||
'close-draft-prs.yml',
|
'close-draft-prs.yml',
|
||||||
'dismiss-unauthorized-pr-approvals.yml',
|
'dismiss-unauthorized-pr-approvals.yml',
|
||||||
'pr-gate.yml',
|
|
||||||
'pr-target-validator.yml',
|
'pr-target-validator.yml',
|
||||||
'pr-template-format.yml',
|
'pr-template-format.yml',
|
||||||
'require-issue-link.yml',
|
'require-issue-link.yml',
|
||||||
|
|||||||
@@ -61,13 +61,11 @@ REQUIRED_CHECKS_MAIN=(
|
|||||||
"security-scan"
|
"security-scan"
|
||||||
"Changeset Required / changeset-lint"
|
"Changeset Required / changeset-lint"
|
||||||
"Docs Required / docs-lint"
|
"Docs Required / docs-lint"
|
||||||
"PR Gate / size-check"
|
|
||||||
"Validate Branch Name / check-branch"
|
"Validate Branch Name / check-branch"
|
||||||
)
|
)
|
||||||
|
|
||||||
REQUIRED_CHECKS_NEXT=(
|
REQUIRED_CHECKS_NEXT=(
|
||||||
"test"
|
"test"
|
||||||
"PR Gate / size-check"
|
|
||||||
"Validate Branch Name / check-branch"
|
"Validate Branch Name / check-branch"
|
||||||
"Changeset Required / changeset-lint"
|
"Changeset Required / changeset-lint"
|
||||||
"Docs Required / docs-lint"
|
"Docs Required / docs-lint"
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ describe('INERT_WORKFLOWS allowlist integrity guard', () => {
|
|||||||
const knownInert = [
|
const knownInert = [
|
||||||
'stale.yml', 'branch-cleanup.yml', 'branch-naming.yml', 'auto-label-issues.yml',
|
'stale.yml', 'branch-cleanup.yml', 'branch-naming.yml', 'auto-label-issues.yml',
|
||||||
'auto-branch.yml', 'auto-backmerge.yml', 'close-draft-prs.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',
|
'pr-template-format.yml', 'require-issue-link.yml', 'changeset-required.yml',
|
||||||
'docs-required.yml', 'discord-changelog.yml',
|
'docs-required.yml', 'discord-changelog.yml',
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user