Files
codex/entrypoint.sh
T
jiantw83 af770b5d5c
CI / 計算版本號 (pull_request) Successful in 2s
CI / 品質檢查 (pull_request) Successful in 8s
AI / Code Review (pull_request) Failing after 31s
fix(entrypoint): 避免未定義環境變數中止執行
2026-06-24 10:30:07 +00:00

26 lines
585 B
Bash

#!/bin/bash
set -eo pipefail
if [[ -z "${OAUTH:-}" ]]; then
echo "OAUTH is required: provide base64 encoded Codex auth.json." >&2
exit 1
fi
if [[ -z "${MODEL:-}" ]]; then
echo "MODEL is required." >&2
exit 1
fi
CODEX_HOME="${CODEX_HOME:-/root/.codex}"
PROMPT="${PROMPT:-請自我介紹}"
mkdir -p "$CODEX_HOME"
printf '%s' "$OAUTH" | base64 -d > "$CODEX_HOME/auth.json"
chmod 600 "$CODEX_HOME/auth.json"
codex exec --dangerously-bypass-approvals-and-sandbox --model "$MODEL" "$PROMPT"
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
echo "text=completed" >> "$GITHUB_OUTPUT"
fi