Stream Claude output to console

This commit is contained in:
2026-07-21 01:40:42 +09:00
parent 5039c728cb
commit 0a3e650664
+9 -1
View File
@@ -35,7 +35,15 @@ FINAL_PROMPT="$(envsubst < "${ACTION_PATH}/scripts/prompt.md")"
# Claude refuses --dangerously-skip-permissions as root outside a sandbox.
export IS_SANDBOX=1
claude --print --dangerously-skip-permissions "${FINAL_PROMPT}" \
# Stream events so the runner sees output and does not kill the job as a zombie.
STREAM_FILE="$(mktemp)"
claude --print --dangerously-skip-permissions \
--output-format stream-json --verbose "${FINAL_PROMPT}" \
| tee "${STREAM_FILE}" \
| jq -r --unbuffered '[.type, (.message.content[]?.name // empty)] | join(" ")'
jq -r 'select(.type == "result") | .result // ("Bot failed: " + .subtype)' "${STREAM_FILE}" \
| ansifilter > "${COMMENT_FILE}"
post_comment