From 1605d2f2529fa69a4bb7581cf911e6b67d77dfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Richez?= Date: Wed, 27 Sep 2023 09:18:59 +0200 Subject: [PATCH] add workflow to check image size --- .github/workflows/check-images.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/check-images.yaml diff --git a/.github/workflows/check-images.yaml b/.github/workflows/check-images.yaml new file mode 100644 index 0000000..7e8980b --- /dev/null +++ b/.github/workflows/check-images.yaml @@ -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