From 162ef3cd7b4c5aef482a35d0ff3b725d4fa68ee1 Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Thu, 9 Jul 2026 09:30:55 +0900 Subject: [PATCH] Share the login result via comment --- scripts/run-codex.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/run-codex.sh b/scripts/run-codex.sh index 87f2a68..95f4b55 100644 --- a/scripts/run-codex.sh +++ b/scripts/run-codex.sh @@ -4,10 +4,10 @@ set -euo pipefail git config --global user.name bot git config --global user.email noreply@capsulizers.com -OUTPUT_FILE="$(mktemp)" +COMMENT_FILE="$(mktemp)" post_comment() { - COMMENT_JSON="$(jq -n --rawfile body "${OUTPUT_FILE}" '{body: $body}')" + COMMENT_JSON="$(jq -n --rawfile body "${COMMENT_FILE}" '{body: $body}')" curl --fail-with-body --silent --show-error \ -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ @@ -17,14 +17,13 @@ post_comment() { } if ! codex login status > /dev/null 2>&1; then - LOGIN_FILE="$(mktemp)" - codex login --device-auth > "${LOGIN_FILE}" 2>&1 & + codex login --device-auth 2>&1 | ansifilter > "${COMMENT_FILE}" & LOGIN_PID="${!}" sleep 3 - ansifilter < "${LOGIN_FILE}" > "${OUTPUT_FILE}" post_comment wait "${LOGIN_PID}" - exit 1 + codex login status 2>&1 | ansifilter > "${COMMENT_FILE}" + post_comment fi export ISSUE_COMMENTS="$( @@ -38,6 +37,6 @@ FINAL_PROMPT="$(envsubst < "${ACTION_PATH}/scripts/prompt.md")" codex exec \ --dangerously-bypass-approvals-and-sandbox \ - "${FINAL_PROMPT}" > "${OUTPUT_FILE}" 2>&1 + "${FINAL_PROMPT}" > "${COMMENT_FILE}" 2>&1 post_comment