From a90e2952c5bfca9b70d31ba0c289fb62bd16f08c Mon Sep 17 00:00:00 2001 From: Peter Hrvola Date: Thu, 5 Sep 2024 14:08:20 +0200 Subject: [PATCH] Create filesize.yml --- .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..12a7a29a --- /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" -size +2M` + if [ "$SIZE" ]; then + echo -n "File too large: " `du -h $line` + FAIL=1 + fi + done <<< "$CHANGED" + exit $FAIL