Skip to content

Commit

Permalink
fix: In POSIX sh, local is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
effoeffi committed Mar 11, 2024
1 parent 3c73c6b commit 3a39d49
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions breaking/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3a39d49

Please sign in to comment.