From ff87f999479f912e270324ad54794d2bdb2a5eab Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Wed, 28 Oct 2026 09:51:51 +0100 Subject: [PATCH] ci(size-limit): Measure bundles when increases are accepted Co-Authored-By: GPT-6 --- AGENTS.md | 1 + dev-packages/size-limit-gh-action/index.mjs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 1539af03e28e..9745eccb96ca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,6 +64,7 @@ Uses **Git Flow** (see `docs/gitflow.md`). - **Omit the "Summary" heading** in PR bodies — lead with the summary text itself, no `## Summary` header. - Include `Fixes #` somewhere in the PR body so the merge auto-closes the linked issue. - 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.`;