ENH: Add example with attachment #93
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: File Size Check | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
- name: List all changed files | |
run: | | |
# MAXSIZE is 10 MB | |
MAXSIZE=10000000 | |
for FILENAME in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
FILESIZE=$(stat -c%s "$FILENAME") | |
echo "Size of $FILENAME = $FILESIZE bytes." | |
if (( FILESIZE > MAXSIZE)); then | |
echo "$FILENAME is too big. Only $MAXSIZE bytes allowed." | |
exit 1 | |
fi | |
done |