diff --git a/breaking/entrypoint.sh b/breaking/entrypoint.sh index bc65028..e5d885d 100755 --- a/breaking/entrypoint.sh +++ b/breaking/entrypoint.sh @@ -1,7 +1,24 @@ #!/bin/sh set -e -source $GITHUB_WORKSPACE/common/common.sh +write_output () { + local output="$1" + if [ -n "$output_to_file" ]; then + local file_output="$2" + if [ -z "$file_output" ]; then + file_output=$output + fi + echo "$file_output" >> "$output_to_file" + fi + # 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: diff exceeds the 1MB limit, truncating output..." >&2 + output=$(echo "$output" | head -c 1000000) + fi + echo "$output" >>"$GITHUB_OUTPUT" +} readonly base="$1" readonly revision="$2" diff --git a/changelog/entrypoint.sh b/changelog/entrypoint.sh index d6723ca..1b0767c 100755 --- a/changelog/entrypoint.sh +++ b/changelog/entrypoint.sh @@ -1,7 +1,24 @@ #!/bin/sh set -e -source $GITHUB_WORKSPACE/common/common.sh +write_output () { + local output="$1" + if [ -n "$output_to_file" ]; then + local file_output="$2" + if [ -z "$file_output" ]; then + file_output=$output + fi + echo "$file_output" >> "$output_to_file" + fi + # 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: diff exceeds the 1MB limit, truncating output..." >&2 + output=$(echo "$output" | head -c 1000000) + fi + echo "$output" >>"$GITHUB_OUTPUT" +} readonly base="$1" readonly revision="$2" diff --git a/common/common.sh b/common/common.sh deleted file mode 100644 index 15d555c..0000000 --- a/common/common.sh +++ /dev/null @@ -1,18 +0,0 @@ -write_output () { - local output="$1" - if [ -n "$output_to_file" ]; then - local file_output="$2" - if [ -z "$file_output" ]; then - file_output=$output - fi - echo "$file_output" >> "$output_to_file" - fi - # 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: diff exceeds the 1MB limit, truncating output..." >&2 - output=$(echo "$output" | head -c 1000000) - fi - echo "$output" >>"$GITHUB_OUTPUT" -} \ No newline at end of file diff --git a/diff/entrypoint.sh b/diff/entrypoint.sh index 6a75583..67127ed 100755 --- a/diff/entrypoint.sh +++ b/diff/entrypoint.sh @@ -1,7 +1,24 @@ #!/bin/sh set -e -source $GITHUB_WORKSPACE/common/common.sh +write_output () { + local output="$1" + if [ -n "$output_to_file" ]; then + local file_output="$2" + if [ -z "$file_output" ]; then + file_output=$output + fi + echo "$file_output" >> "$output_to_file" + fi + # 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: diff exceeds the 1MB limit, truncating output..." >&2 + output=$(echo "$output" | head -c 1000000) + fi + echo "$output" >>"$GITHUB_OUTPUT" +} readonly base="$1" readonly revision="$2"