Skip to content

Commit

Permalink
fix(action): limit content size to 40MB (#40)
Browse files Browse the repository at this point in the history
* fix(action): limit content size to 50MB

* fix(limit): don't echo output on big file
  • Loading branch information
orhun authored Oct 14, 2024
1 parent 14bb673 commit d3e272c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
echo "content<<EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT" >>$GITHUB_OUTPUT
echo "EOF" >>$GITHUB_OUTPUT
# 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
Expand All @@ -42,4 +44,4 @@ echo "changelog=$OUTPUT" >>$GITHUB_OUTPUT
echo "version=$(jq -r '.[0].version' $CONTEXT)" >>$GITHUB_OUTPUT

# Pass exit code to the next step
echo "exit_code=$exit_code" >>$GITHUB_OUTPUT
echo "exit_code=$exit_code" >>$GITHUB_OUTPUT

0 comments on commit d3e272c

Please sign in to comment.