From 3a39d498d235eef4658bffde928983940d9536ac Mon Sep 17 00:00:00 2001 From: effoeffi <effoeffi@gmail.com> Date: Mon, 11 Mar 2024 15:36:56 +0200 Subject: [PATCH] fix: In POSIX sh, local is undefined --- breaking/entrypoint.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/breaking/entrypoint.sh b/breaking/entrypoint.sh index e574c73..b0ddf51 100755 --- a/breaking/entrypoint.sh +++ b/breaking/entrypoint.sh @@ -1,36 +1,37 @@ #!/bin/sh set -e +readonly base="$1" +readonly revision="$2" +readonly fail_on_diff="$3" +readonly include_checks="$4" +readonly include_path_params="$5" +readonly deprecation_days_beta="$6" +readonly deprecation_days_stable="$7" +readonly exclude_elements="$8" +readonly composed="$9" +readonly output_to_file="$10" + write_output () { - local output="$1" + _write_output_output="$1" if [ -n "$output_to_file" ]; then - local file_output="$2" - if [ -z "$file_output" ]; then - file_output=$output + _write_output_file_output="$2" + if [ -z "$_write_output_file_output" ]; then + _write_output_file_output=$_write_output_output + fi - echo "$file_output" >> "$output_to_file" + echo "$_write_output_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) + size=$(echo "$_write_output_output" | wc -c) if [ "$size" -ge "1000000" ]; then echo "WARN: diff exceeds the 1MB limit, truncating output..." >&2 - output=$(echo "$output" | head -c 1000000) + _write_output_output=$(echo "$_write_output_output" | head -c 1000000) fi - echo "$output" >>"$GITHUB_OUTPUT" + echo "$_write_output_output" >>"$GITHUB_OUTPUT" } -readonly base="$1" -readonly revision="$2" -readonly fail_on_diff="$3" -readonly include_checks="$4" -readonly include_path_params="$5" -readonly deprecation_days_beta="$6" -readonly deprecation_days_stable="$7" -readonly exclude_elements="$8" -readonly composed="$9" -readonly output_to_file="${10}" - echo "running oasdiff breaking... base: $base, revision: $revision, fail_on_diff: $fail_on_diff, include_checks: $include_checks, include_path_params: $include_path_params, deprecation_days_beta: $deprecation_days_beta, deprecation_days_stable: $deprecation_days_stable, exclude_elements: $exclude_elements, composed: $composed, output_to_file: $output_to_file" # Build flags to pass in command