-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed8d983
commit 3b37908
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: check-image-size | ||
on: | ||
- pull_request | ||
jobs: | ||
check-image-size: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- shell: bash | ||
run: | | ||
files=$(git diff --name-only origin/${{ github.base_ref }} | grep -E '.+\.png$' | xargs du -h --threshold=1M | cut -f2) | ||
for file in $files; do | ||
echo "::warning title=Big image,file=$file::This image is bigger than 1MB. Consider reducing its pixel size to match the actual size on the website, or use pngcrush or similar to maximize the compression" | ||
done | ||
if ! [[ -z "$files" ]]; then | ||
exit 1 | ||
fi |