fix(action): limit content size to 40MB (#40)

* fix(action): limit content size to 50MB

* fix(limit): don't echo output on big file
This commit is contained in:
Orhun Parmaksız
2024-10-14 18:12:39 +03:00
committed by GitHub
parent 14bb67385a
commit d3e272c587

10
run.sh
View File

@@ -24,16 +24,18 @@ exit_code=$?
CONTEXT="$(mktemp)"
GIT_CLIFF_OUTPUT="$CONTEXT" ./bin/git-cliff $args --context
# Output to console
cat "$OUTPUT"
# Revert permissions
chown -R "$owner" .
# Set the changelog content
# Set the changelog content (max: 50MB)
FILESIZE=$(stat -c%s "$OUTPUT")
MAXSIZE=$((40 * 1024 * 1024))
if [ "$FILESIZE" -le "$MAXSIZE" ]; then
echo "content<<EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT" >>$GITHUB_OUTPUT
echo "EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT"
fi
# Set output file
echo "changelog=$OUTPUT" >>$GITHUB_OUTPUT