fix tests #119
Workflow file for this run
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: Check File Sizes | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
check-file-size: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # This ensures we get the full history | |
- name: Check file sizes | |
run: | | |
MAX_SIZE_BYTES=$((10 * 1024 * 1024)) # 10MB in bytes | |
# Get list of files changed in this PR | |
FILES_CHANGED=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) | |
# Check each file | |
for file in $FILES_CHANGED; do | |
if [ -f "$file" ]; then | |
size=$(stat -c%s "$file") | |
if [ $size -gt $MAX_SIZE_BYTES ]; then | |
echo "Error: $file is larger than 10MB (size: $size bytes)" | |
exit 1 | |
fi | |
fi | |
done | |
echo "All files are within the size limit." |