refactor(codex_account): 改用 Node.js 實作帳號查詢
CI / Release Tag Version (pull_request) Successful in 4s
CI / Codex (pull_request) Successful in 13s

This commit is contained in:
2026-06-29 09:53:07 +00:00
parent 2e36931f83
commit 68c78e6736
5 changed files with 137 additions and 104 deletions
+3 -18
View File
@@ -7,7 +7,7 @@
# 讓 codex CLI 取得登入憑證。
# 3. 執行 inputs.prompt 指定的提示詞,並把 Codex 的輸出寫入
# steps.codex.outputs.text 供後續 step 使用。
# - 若未提供 promptPROMPT 為空),則改呼叫 app/codex_account.py 取得目前
# - 若未提供 promptPROMPT 為空),則改呼叫 app/codex_account.js 取得目前
# 登入帳號的 email,寫入 text 輸出後結束(用於驗證身分)。
# 更新日期:2026/06/29 14:18:26
# =============================================================================
@@ -62,21 +62,6 @@ runs:
exit 1
fi
# 安裝 jq,供 app/codex_account.py 以 shell 解析 JSON-RPC 回應。
if ! command -v jq >/dev/null 2>&1; then
if command -v apt-get >/dev/null 2>&1; then
apt_get='apt-get'
if command -v sudo >/dev/null 2>&1; then
apt_get='sudo apt-get'
fi
$apt_get update
$apt_get install -y jq
else
echo 'jq is required but apt-get is not available.' >&2
exit 1
fi
fi
# 全域安裝 Codex CLI 套件,安裝後可直接使用 codex 指令
npm install -g @openai/codex
@@ -111,8 +96,8 @@ runs:
fi
# 當 PROMPT 為空時,改走「取得登入帳號 email」分支
if [ -z "$PROMPT" ]; then
# 呼叫 codex_account.py 取得目前登入帳號的 email$GITHUB_ACTION_PATH 為 action 根目錄)
email="$(bash "$GITHUB_ACTION_PATH/app/codex_account.py")"
# 呼叫 codex_account.js 取得目前登入帳號的 email$GITHUB_ACTION_PATH 為 action 根目錄)
email="$(node "$GITHUB_ACTION_PATH/app/codex_account.js")"
# 將 email 寫入 text 輸出($GITHUB_OUTPUT 為步驟輸出檔)
echo "text=$email" >> "$GITHUB_OUTPUT"
# 以 0 正常退出,不再執行 codex exec