feat(codex_account): 改用 shell 取得登入帳號並補上容器環境

This commit is contained in:
2026-06-29 09:48:24 +00:00
parent 328c8a12dc
commit f8f67524ae
3 changed files with 95 additions and 60 deletions
+16 -1
View File
@@ -62,6 +62,21 @@ 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
@@ -97,7 +112,7 @@ runs:
# 當 PROMPT 為空時,改走「取得登入帳號 email」分支
if [ -z "$PROMPT" ]; then
# 呼叫 codex_account.py 取得目前登入帳號的 email$GITHUB_ACTION_PATH 為 action 根目錄)
email="$(python3 "$GITHUB_ACTION_PATH/app/codex_account.py")"
email="$(bash "$GITHUB_ACTION_PATH/app/codex_account.py")"
# 將 email 寫入 text 輸出($GITHUB_OUTPUT 為步驟輸出檔)
echo "text=$email" >> "$GITHUB_OUTPUT"
# 以 0 正常退出,不再執行 codex exec