Update of the tutorials #1140
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: 'File Size Checker' | |
on: [push, pull_request] | |
jobs: | |
check-file-size: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout code' | |
uses: actions/checkout@v4 | |
- name: 'Check file size' | |
run: | | |
# Set the maximum file size to 1 MB | |
MAX_SIZE=1048576 | |
# Find all files in the repository excluding .git directory, and handle spaces in file names | |
find . -type f ! -path './.git/*' -print0 | while IFS= read -r -d '' FILE; do | |
SIZE=$(wc -c <"$FILE") | |
if [ "$SIZE" -gt "$MAX_SIZE" ]; then | |
echo "Error: $FILE exceeds the maximum file size limit of 1 MB." | |
exit 1 | |
fi | |
done | |
echo "All files are within the size limit." | |
permissions: read-all |