From bec0d691a9f3193fe383aa43f3bcfb3b219bf4de Mon Sep 17 00:00:00 2001 From: Peter Hrvola Date: Wed, 28 Aug 2024 12:52:17 +0200 Subject: [PATCH] Create filesize check --- .github/workflows/filesize.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/filesize.yml diff --git a/.github/workflows/filesize.yml b/.github/workflows/filesize.yml new file mode 100644 index 00000000..1a0643c0 --- /dev/null +++ b/.github/workflows/filesize.yml @@ -0,0 +1,22 @@ +name: File size check +on: [pull_request] +jobs: + File-Size: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 2 + - name: check size + shell: bash + run: | + CHANGED=`git diff --name-only -r HEAD^1 HEAD` + FAIL=0 + while IFS= read -r line; do + SIZE=`find -maxdepth 1 -name "$line" -not -name '*.drawio' -size +2M` + if [ "$SIZE" ]; then + echo -n "File too large: " `du -h $line` + FAIL=1 + fi + done <<< "$CHANGED" + exit $FAIL