From 35bb40cf14e0111a365ca8073ec5bdaf0c9bf6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= Date: Sun, 26 Apr 2026 13:14:29 +0300 Subject: [PATCH] fix: avoid exit code 1 when output-file is not set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [[ -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 --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0bfac85..7222d16 100644 --- a/action.yml +++ b/action.yml @@ -97,5 +97,7 @@ runs: [[ -n "$CG_REQUIRE_TRAILER" ]] && ARGS+=(--require-trailer "$CG_REQUIRE_TRAILER") [[ -n "$CG_OUTPUT_FILE" ]] && ARGS+=(--output-file "$CG_OUTPUT_FILE") commit-guard "${ARGS[@]}" - [[ -n "$CG_OUTPUT_FILE" ]] && echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT" + if [[ -n "$CG_OUTPUT_FILE" ]]; then + echo "output-file=$CG_OUTPUT_FILE" >> "$GITHUB_OUTPUT" + fi shell: bash