File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 84
84
if [[ $type =~ ^(WEBP|SVG|ICO)$ ]]; then
85
85
echo "✅ $file"
86
86
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. 🙏"
88
88
FAILED=1
89
89
fi
90
90
done
94
94
env :
95
95
FOLDER : ./static
96
96
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" -regextype posix-egrep -regex '.+\.(bmp|ico|jpg|jpeg|png|svg|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
+
97
122
report-new-dependencies :
98
123
runs-on : ubuntu-22.04
99
124
if : github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
You can’t perform that action at this time.
0 commit comments