Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/scripts/check-workflow-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ GITHUB_LIMIT_BYTES=512000
GATE_BYTES="${WORKFLOW_SIZE_GATE_BYTES:-470000}"
WARN_BYTES=$((GATE_BYTES - 25000))

# The gate above is the ceiling; the baseline below is the RATCHET. The gate
# alone only objects once a file is nearly at the wall, so growth accumulates
# invisibly until one unlucky PR has to pay for everyone: qwen-autofix.yml
# regained 78 KB when its prose moved out (#9517) and gave 25 KB of it back in
# a single feature commit two days later, unremarked. Each file's recorded size
# lives in .size-baseline; exceeding it by more than the allowance fails until
# the number is updated in the same PR, which turns the drift into one line a
# reviewer sees.
BASELINE_FILE='.github/workflows/.size-baseline'
GROWTH_ALLOWANCE="${WORKFLOW_SIZE_GROWTH_ALLOWANCE:-4096}"
# Loose enough that ordinary edits do not churn the manifest, tight enough that
# a file which shed real weight gets its baseline reclaimed rather than banking
# the slack for the next unreviewed 25 KB.
SLACK_BYTES=20000

declare -A baseline=()
if [[ -r "${BASELINE_FILE}" ]]; then
while read -r recorded name; do
[[ -z "${recorded}" || "${recorded}" == \#* ]] && continue
baseline["${name}"]="${recorded}"
done <"${BASELINE_FILE}"
else
echo "::error::${BASELINE_FILE} is missing or unreadable — the growth ratchet cannot run"
exit 1
fi

status=0
shopt -s nullglob
for file in .github/workflows/*.yml .github/workflows/*.yaml; do
Expand All @@ -24,16 +50,28 @@ for file in .github/workflows/*.yml .github/workflows/*.yaml; do
status=1
continue
fi
size="${size// /}"
pct=$((size * 100 / GITHUB_LIMIT_BYTES))
if ((size > GATE_BYTES)); then
echo "::error file=${file}::${file} is ${size} bytes — ${pct}% of GitHub's ${GITHUB_LIMIT_BYTES}-byte start-runs limit, past this repo's ${GATE_BYTES}-byte gate. Move prose into a sibling .md and long steps into .github/scripts/; do not raise the gate."
status=1
elif ((size > WARN_BYTES)); then
echo "::warning file=${file}::${file} is ${size} bytes (${pct}% of GitHub's limit) — approaching the ${GATE_BYTES}-byte gate."
fi

base="${baseline[${file##*/}]:-}"
if [[ -z "${base}" ]]; then
echo "::error file=${file}::${file} has no entry in ${BASELINE_FILE}. Add '${size} ${file##*/}' so its growth is tracked."
status=1
elif ((size > base + GROWTH_ALLOWANCE)); then
echo "::error file=${file}::${file} grew to ${size} bytes, $((size - base)) over its recorded ${base} (allowance ${GROWTH_ALLOWANCE}). Move prose into a sibling .md and long steps into .github/scripts/ — or, if the growth is real, update ${BASELINE_FILE} in this PR and say why."
status=1
elif ((size + SLACK_BYTES < base)); then
echo "::warning file=${file}::${file} is ${size} bytes, $((base - size)) under its recorded ${base} — lower the entry in ${BASELINE_FILE} so the slack is not banked."
fi
done

if ((status == 0)); then
echo "✅ every workflow file is under the ${GATE_BYTES}-byte gate"
echo "✅ every workflow file is under the ${GATE_BYTES}-byte gate and within ${GROWTH_ALLOWANCE} bytes of its recorded baseline"
fi
exit "${status}"
66 changes: 66 additions & 0 deletions .github/workflows/.size-baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Recorded byte size of each workflow file, enforced by
# .github/scripts/check-workflow-size.sh.
#
# The absolute gate in that script is the ceiling; this file is the ratchet.
# A workflow may not grow past its recorded size by more than the allowance
# without updating the number here IN THE SAME PR — which is the point: it
# turns invisible drift into one reviewed line. qwen-autofix.yml regained
# 78 KB when its prose moved to qwen-autofix.md (#9517), then gave 25 KB of
# it back in a single feature commit two days later, with nothing objecting
# until the next PR ran out of ceiling.
#
# Growing a file is allowed — deliberately. Prefer moving prose into the
# sibling .md and long steps into .github/scripts/ first; if the growth is
# real, bump the number and say why in the PR.
2226 assign-issue-owner.yml
3480 audio-capture-prebuilds.yml
9023 auto-minimize-spam.yml
4638 build-and-publish-image.yml
29715 cd-cua-driver.yml
2076 cd-mobile-mcp.yml
69782 ci.yml
1482 codeql.yml
9389 comment-attachment-guard.yml
31677 desktop-release.yml
2038 docs-page-action.yml
10005 dsw-swe-verified-release.yml
12340 e2e.yml
11394 finalize-release.yml
15871 live-host-release.yml
6384 live-host.yml
7642 main-ci-failure-issue.yml
1686 npm-cache.yml
7299 pr-force-push-reminder.yml
6495 pr-self-report-label.yml
9646 qwen-autofix-fork-bridge.yml
5942 qwen-autofix-fork-signal.yml
419995 qwen-autofix.yml
7061 qwen-ci-flaky-rerun.yml
151937 qwen-code-pr-review.yml
79041 qwen-fleet-shepherd.yml
20525 qwen-issue-followup-bot.yml
5760 qwen-pr-safety-precheck.yml
27648 qwen-triage-finalize.yml
344548 qwen-triage.yml
9657 release-sdk-java.yml
22037 release-sdk-python.yml
19094 release-sdk.yml
14546 release-vscode-companion.yml
39291 release.yml
43717 repo-hygiene.yml
1079 scorecard-monthly.yml
10691 sdk-java.yml
3886 sdk-python.yml
3197 security-checks.yml
6777 serve-ab-publish.yml
17013 serve-ab.yml
2641 stale.yml
8653 sync-cua-driver-to-oss.yml
10920 sync-desktop-to-oss.yml
10018 sync-live-host-to-oss.yml
10138 sync-release-to-oss.yml
3303 update-ecs-runner-qwen.yml
2307 web-shell-visuals-cleanup.yml
15380 web-shell-visuals-publish.yml
16384 web-shell-visuals.yml
4712 windows-runner-smoke.yml
Loading
Loading