Skip to content

Commit 18dfae2

Browse files
authored
Fixed error handling (#429)
Have fixed the error handling to emit warning only in case any one of the files is non empty and not a valid JSON.
1 parent adf1f90 commit 18dfae2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,13 @@ runs:
327327
if jq -e . "${TEMP_STDERR}" >/dev/null 2>&1; then
328328
ERROR_JSON=$(jq -c '.error // empty' "${TEMP_STDERR}")
329329
fi
330-
if ! { jq -e . "${TEMP_STDERR}" >/dev/null 2>&1 && jq -e . "${TEMP_STDOUT}" >/dev/null 2>&1; }; then
331-
echo "::warning::Gemini CLI output was not valid JSON"
330+
331+
if { [[ -s "${TEMP_STDERR}" ]] && ! jq -e . "${TEMP_STDERR}" >/dev/null 2>&1; }; then
332+
echo "::warning::Gemini CLI stderr was not valid JSON"
333+
fi
334+
335+
if { [[ -s "${TEMP_STDOUT}" ]] && ! jq -e . "${TEMP_STDOUT}" >/dev/null 2>&1; }; then
336+
echo "::warning::Gemini CLI stdout was not valid JSON"
332337
fi
333338
334339

0 commit comments

Comments
 (0)