Skip to content

Commit

Permalink
add workflow to check image size
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienRichez committed Sep 27, 2023
1 parent ed8d983 commit 1605d2f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/check-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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 file=$file,line=0::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

0 comments on commit 1605d2f

Please sign in to comment.