File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 8484 if [[ $type =~ ^(WEBP|SVG|ICO)$ ]]; then
8585 echo "✅ $file"
8686 else
87- >&2 echo "❌ $file incorrect. Please use only webp or svg format 🙏"
87+ >&2 echo "❌ $file incorrect. Please use only webp or svg format. 🙏"
8888 FAILED=1
8989 fi
9090 done
9494 env :
9595 FOLDER : ./static
9696
97+ lint-image-size :
98+ runs-on : ubuntu-22.04
99+ steps :
100+ - name : Check out repository
101+ uses : actions/checkout@v4
102+
103+ - name : Lint image files
104+ run : |
105+ MAX_SIZE=200000
106+ FAILED=0
107+ for file in $(find "$FOLDER" "*.webp"); do
108+ size=$(wc -c "$file" | awk '{print $1}')
109+ if [ "$size" -gt "$MAX_SIZE" ]; then
110+ >&2 echo "❌ $file is $size. Please reduce its size to a maximum of $MAX_SIZE. 🙏"
111+ FAILED=1
112+ else
113+ echo "✅ $file"
114+ fi
115+ done
116+ if [ "${FAILED}" = "1" ]; then
117+ exit 1
118+ fi
119+ env :
120+ FOLDER : ./static
121+
97122 report-new-dependencies :
98123 runs-on : ubuntu-22.04
99124 if : github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
You can’t perform that action at this time.
0 commit comments