Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,16 @@ runs:
FAILED=false

# Run Gemini CLI with the provided prompt, streaming responses in debug
EXIT_CODE=0
if [[ "${DEBUG}" = true ]]; then
echo "::warning::Gemini CLI debug logging is enabled. This will stream responses, which could reveal sensitive information if processed with untrusted inputs."
if ! { gemini --yolo --prompt "${PROMPT}" 2> >(tee "${TEMP_STDERR}" >&2) | tee "${TEMP_STDOUT}"; }; then
EXIT_CODE=$?
FAILED=true
fi
else
if ! gemini --yolo --prompt "${PROMPT}" 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
EXIT_CODE=$?
FAILED=true
fi
fi
Expand All @@ -323,10 +326,39 @@ runs:
echo "EOF" >> "${GITHUB_OUTPUT}"

if [[ "${FAILED}" = true ]]; then
case "${EXIT_CODE}" in
1)
MSG="General error"
;;
41)
MSG="Authentication failure. Please check your credentials (API key or Google Cloud auth)."
;;
42)
MSG="Invalid input or configuration. Please check your prompt or CLI arguments."
;;
52)
MSG="Configuration error. Failed to save settings."
;;
53)
MSG="Turn limit exceeded. The conversation has reached its maximum length."
;;
126)
MSG="Command invoked cannot execute"
;;
127)
MSG="Command not found"
;;
130)
MSG="User cancelled. The operation was interrupted."
;;
*)
MSG="Unknown error (exit code: ${EXIT_CODE})"
esac

LAST_LINE="$(tail -n1 "${TEMP_STDERR}")"
echo "::error title=Gemini CLI execution failed::${LAST_LINE}"
printf "::error title=Gemini CLI execution failed (%s)::%s\n" "${MSG}" "${LAST_LINE}"
echo "See logs for more details"
exit 1
exit "${EXIT_CODE}"
fi
env:
DEBUG: '${{ fromJSON(inputs.gemini_debug || false) }}'
Expand Down
Loading