A size checker action which checks for files > 100KB. #8
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
name: Enforce 100KB size limit | |
on: | |
pull_request | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Check only files modified by this change to see if any exceed 100K | |
- name: Size check | |
run: | | |
head_name=${{ github.head_ref || github.ref_name }} | |
echo "HEAD NAME" $head_name | |
changed=$(git diff --name-only -r ${head_name} HEAD) | |
if [[ -z $changed ]]; then exit 0; fi | |
too_large=$(find $changed -size +100k) | |
if [[ -n $too_large ]]; then echo "Files ${too_large} > 100KB"; exit 1; else exit 0; fi |