Skip to content

Commit

Permalink
Merge branch '1.0' into 1
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 5, 2024
2 parents da268d7 + 5dca115 commit a51e932
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,24 @@ runs:
echo "git diff found modified files when it should not have:"
echo $GIT_DIFF
echo "sha1sum of files that are different:"
COPIED_COUNT=0
for FILEPATH in $(git diff --cached --name-only); do
if [[ -f $FILEPATH ]]; then
sha1sum $FILEPATH
# Only copy if the file is less than 10 megabytes to prevent malicous behaviour
# Only copy a max of 10 files, also to prevent malicious behaviour
MEGABYTES=$(ls -l --b=M "$DIST_DIR/$FILEPATH" | cut -d " " -f5 | sed "s/M//")
if (($MEGABYTES >= 10)); then
echo "File $FILEPATH is larger than 10 megabytes, not copying"
elif (($COPIED_COUNT >= 10)); then
echo "More than 10 files have been copied, not copying $FILEPATH"
else
cp "$DIST_DIR/$FILEPATH" artifacts
COPIED_COUNT=$((COPIED_COUNT+1))
fi
fi
done
echo "Files that are different have been copied to artifacts directory"
exit 1
fi
fi
Expand Down

0 comments on commit a51e932

Please sign in to comment.