summaryrefslogtreecommitdiff
path: root/.github/workflows/scripts/check-size.sh
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/scripts/check-size.sh')
-rwxr-xr-x.github/workflows/scripts/check-size.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/.github/workflows/scripts/check-size.sh b/.github/workflows/scripts/check-size.sh
new file mode 100755
index 0000000..15027bd
--- /dev/null
+++ b/.github/workflows/scripts/check-size.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -eu
+
+SIZE_LIMIT=150000
+
+check_size() {
+ local size=$(stat --printf="%s" $1)
+ if [ "$size" -gt "$SIZE_LIMIT" ]; then
+ echo "File $1 is bigger than specified $SIZE_LIMIT limit"
+ exit 1
+ fi
+}
+
+git diff --name-only `git merge-base origin/master HEAD` | while IFS= read -r file; do
+ case "$file" in
+ *.webp)
+ echo "Checking size of $file"
+ check_size $file
+ ;;
+ *)
+ echo "Skipping $file"
+ ;;
+ esac
+done
+