Skip to content

Commit 35bb40c

Browse files
committed
fix: avoid exit code 1 when output-file is not set
[[ -n "" ]] && ... short-circuits with exit code 1, which the shell interprets as a failure under set -e. Use an if block so the script always exits with commit-guard's own exit code. Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
1 parent 4f968cd commit 35bb40c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@ runs:
9797
[[ -n "$CG_REQUIRE_TRAILER" ]] && ARGS+=(--require-trailer "$CG_REQUIRE_TRAILER")
9898
[[ -n "$CG_OUTPUT_FILE" ]] && ARGS+=(--output-file "$CG_OUTPUT_FILE")
9999
commit-guard "${ARGS[@]}"
100-
[[ -n "$CG_OUTPUT_FILE" ]] && echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT"
100+
if [[ -n "$CG_OUTPUT_FILE" ]]; then
101+
echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT"
102+
fi
101103
shell: bash

0 commit comments

Comments
 (0)