diff --git a/AGENTS.md b/AGENTS.md index d3337807b807..28fcc07f144a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -61,6 +61,7 @@ Uses **Git Flow** (see `docs/gitflow.md`). - Use `.github/PULL_REQUEST_TEMPLATE.md` for the body (`gh pr create --body` skips it). Ideally 1-2 sentences per field, no AI walkthrough. - Always open PRs as draft. +- Never apply the `Accept Bundlesize Increase` label. - **Keep PR descriptions condensed** — usually a few sentences. Explain the _reasoning_: why the change is needed, and any non-obvious decisions or tradeoffs made along the way. Do **not** walk through the implementation or describe what changed file-by-file — the diff already shows that. Only go longer when the decisions genuinely warrant it. ## Architecture diff --git a/dev-packages/size-limit-gh-action/index.mjs b/dev-packages/size-limit-gh-action/index.mjs index 9baaf3b96630..b23a752b1e94 100644 --- a/dev-packages/size-limit-gh-action/index.mjs +++ b/dev-packages/size-limit-gh-action/index.mjs @@ -33,16 +33,14 @@ async function run() { } const octokit = getOctokit(githubToken); + let increaseAccepted = false; if (comparisonBranch) { const { data: currentPr } = await octokit.rest.pulls.get({ ...repo, pull_number: pr.number, }); - if (currentPr.labels.some(label => label.name === OVERRIDE_LABEL)) { - core.info(`Bundle size increase acknowledged by "${OVERRIDE_LABEL}". Skipping size measurement.`); - return; - } + increaseAccepted = currentPr.labels.some(label => label.name === OVERRIDE_LABEL); } const limit = new SizeLimitFormatter(); @@ -155,7 +153,7 @@ async function run() { } else if (!base) { failure = 'No baseline size measurements found. Re-run after the base build completes.'; bodyParts.push(failure); - } else if (increases.length > 0) { + } else if (increases.length > 0 && !increaseAccepted) { failure = `One or more gzipped bundles increased by more than ${MAX_INCREASE_BYTES} bytes. ` + `If this increase is intentional, add the **${OVERRIDE_LABEL}** label to this PR to rerun and accept the check.`;