Action check fille size#75
Conversation
check and make sure no file is laregrthan 150kb in the `img` folder
Removed 'action-check-file-size' branch from workflow triggers.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a GitHub Actions workflow to enforce a maximum file size limit of 150KB for images in the repository. The workflow runs on pushes and pull requests to the main branch, failing the build if any images exceed the specified threshold.
- Introduces automated file size checking for the
imgdirectory - Provides clear error messages showing which files exceed the limit and their sizes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Check for images larger than 150KB | ||
| run: | | ||
| MAX_SIZE="150k" | ||
| LARGE_FILES=$(find img -type f -size +$MAX_SIZE) |
There was a problem hiding this comment.
The find command assumes the img directory exists. If the directory doesn't exist or is empty, the command will fail. Add -d flag or use a path check to handle this gracefully: find . -path ./img -prune -o -path ./img -type f -size +$MAX_SIZE -print or check if the directory exists first with [ -d img ] && ...
| LARGE_FILES=$(find img -type f -size +$MAX_SIZE) | |
| LARGE_FILES=$([ -d img ] && find img -type f -size +$MAX_SIZE) |
| - name: Check for images larger than 150KB | ||
| run: | | ||
| MAX_SIZE="150k" | ||
| LARGE_FILES=$(find img -type f -size +$MAX_SIZE) |
There was a problem hiding this comment.
[nitpick] The workflow only checks files in the img directory but doesn't filter by file type. Consider adding file extension filtering to specifically target image files (e.g., -name '*.jpg' -o -name '*.png' -o -name '*.gif' -o -name '*.jpeg') to avoid false positives from non-image files.
| LARGE_FILES=$(find img -type f -size +$MAX_SIZE) | |
| LARGE_FILES=$(find img -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.gif' \) -size +$MAX_SIZE) |
No description provided.