name: 'Codex CLI' description: 'Codex CLI 工具' author: 'Jeffery' inputs: prompt: description: '傳給 Codex CLI 的提示詞' required: false oauth: description: 'base64 編碼的 Codex OAuth token 檔案內容' required: true outputs: text: description: '輸出的文字' value: ${{ steps.codex.outputs.text }} runs: using: 'composite' steps: - name: 安裝工具 env: OAUTH: ${{ inputs.oauth }} run: | if [ -z "$OAUTH" ]; then echo 'oauth input (secrets.CODEX_OAUTH) is required and must not be empty.' >&2 exit 1 fi npm install -g @openai/codex oauth_file="$HOME/.codex/auth.json" install -d -m 700 "$(dirname "$oauth_file")" printf '%s' "$OAUTH" | base64 -d > "$oauth_file" chmod 600 "$oauth_file" shell: bash - name: 執行工具 id: codex env: MODEL: ${{ vars.CODEX_MODEL }} PROMPT: ${{ inputs.prompt }} run: | if [ -z "$MODEL" ]; then echo 'CODEX_MODEL repository variable is required.' >&2 exit 1 fi if [ -z "$PROMPT" ]; then email="$(python3 "$GITHUB_ACTION_PATH/app/codex_account.py")" echo "text=$email" >> "$GITHUB_OUTPUT" exit 0 fi text="$(codex exec --skip-git-repo-check -s danger-full-access --model "$MODEL" "$PROMPT")" printf '%s\n' "$text" { echo 'text<> "$GITHUB_OUTPUT" shell: bash