Refs #561
This commit is contained in:
@@ -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: |
|
||||
|
||||
Reference in New Issue
Block a user