Skip to content

Commit

Permalink
only call find if there is a diff
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Jan 5, 2022
1 parent 6176643 commit d31ed3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ jobs:
fetch-depth: 0
- name: Check file sizes
run: |
find $(git diff --diff-filter A --name-only ${{ needs.setup.outputs.commit-range }}) -type f -size +${{ env.MAX_FILE_SIZE }} > file_size_report.txt
touch file_size_report.txt
GITDIFF=$(git diff --diff-filter A --name-only ${{ needs.setup.outputs.commit-range }})
if [ -n "$GITDIFF" ]; then
find "$GITDIFF" -type f -size +${{ env.MAX_FILE_SIZE }} > file_size_report.txt
fi
if [[ -s file_size_report.txt ]]; then
echo "Files larger than ${{ env.MAX_FILE_SIZE }} found"
cat file_size_report.txt
Expand Down

0 comments on commit d31ed3a

Please sign in to comment.