name: Check for Large Files

on: push

jobs:
  check-large-files:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Check File Sizes
        run: |
          max_size=$((2 * 1024 * 1024 * 1024))
          for file in $(git ls-tree -r HEAD --name-only); do
              size=$(stat --printf="%s" "$file")
              if [ "$size" -gt "$max_size" ]; then
                  echo "Error: $file exceeds 2GB."
                  exit 1
              fi
          done
