Skip to content

Commit

Permalink
github-action limits output to 1MB, in case breaking exceeds the 1MB …
Browse files Browse the repository at this point in the history
…limit, truncating output (#25)
  • Loading branch information
effoeffi authored Dec 5, 2023
1 parent 4ad4737 commit f19ffbc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions breaking/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ if [ -n "$flags" ]; then
else
output=$(oasdiff breaking "$base" "$revision" | head -n 1)
fi

if [ -n "$output" ]; then
# github-action limits output to 1MB
# we count bytes because unicode has multibyte characters
size=$(echo "$output" | wc -c)
if [ "$size" -ge "1000000" ]; then
echo "WARN: breaking exceeds the 1MB limit, truncating output..." >&2
output=$(echo "$output" | head -c $1000000)
fi
echo "$output" >>$GITHUB_OUTPUT
else
echo "No breaking changes" >>$GITHUB_OUTPUT
Expand Down

0 comments on commit f19ffbc

Please sign in to comment.