feat: add PR size check to CI
Some checks failed
CI / validate (pull_request) Failing after 3s

Refs #561
This commit is contained in:
Alexander Whitestone
2026-03-26 07:06:20 -04:00
parent 1d7fdd0e22
commit 5dbbcd0305

View File

@@ -11,6 +11,34 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: "HARD RULE: Net lines added must be <= 10"
run: |
echo "=== PR Size Budget: 10 lines net max ==="
git diff --shortstat HEAD^ HEAD > diffstat.txt
cat diffstat.txt
INSERTIONS=$(grep "insertion" diffstat.txt | awk '{print $4}' | sed 's/([+-])//g' || echo 0)
DELETIONS=$(grep "deletion" diffstat.txt | awk '{print $6}' | sed 's/([+-])//g' || echo 0)
if [ -z "$INSERTIONS" ]; then INSERTIONS=0; fi
if [ -z "$DELETIONS" ]; then DELETIONS=0; fi
NET_LINES=$(($INSERTIONS - $DELETIONS))
echo "--> Insertions: $INSERTIONS"
echo "--> Deletions: $DELETIONS"
echo "--> Net change: $NET_LINES lines"
if [ "$NET_LINES" -gt 10 ]; then
echo ""
echo "══════════════════════════════════════════════════════════════"
echo " BLOCKED: Net lines added must be less than or equal to 10."
echo " Make this PR smaller, or find something to delete."
echo " (See CONTRIBUTING.md for details)"
echo "══════════════════════════════════════════════════════════════"
exit 1
else
echo "OK: Net change is within budget."
fi
- name: Validate HTML
run: |