Skip to content

Size limit action

Size limit action #7

Workflow file for this run

name: Enforce 100KB size limit
on:
pull_request
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
# Check only files modified by this change to see if any exceed 100K
- name: Size check
run: |
changed=$(git diff --name-only -r HEAD^1 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