Files
setup-codex/action.yml
T
Jeffery 7da6db73e1
CI / 2. TEST (pull_request) Successful in 37s
CI / 3. RESULT (pull_request) Successful in 0s
CI / 1. BUILD (pull_request) Successful in 2s
feat(action): 新增顯示 Codex 帳號步驟
2026-07-02 18:25:22 +08:00

27 lines
878 B
YAML

name: 'Setup Codex CLI'
description: '安裝 Codex CLI 工具'
author: 'Jeffery'
inputs:
oauth:
description: '透過 OAuth 登入 ChatGPT 產生驗證檔,經過 base64 編碼'
required: true
outputs:
message:
description: '輸出訊息'
value: ${{ steps.exchange.outputs.message }}
runs:
using: 'composite'
steps:
- name: Setup Codex
env:
CODEX_NON_INTERACTIVE: 1
run: |
curl -fsSL https://chatgpt.com/codex/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
shell: bash
- name: Login Codex with OAuth
env:
OAUTH: ${{ inputs.oauth }}
run: echo $OAUTH | base64 --decode > ~/.codex/auth.json
- name: Show Codex Account
run: node -e 'console.log(JSON.parse(Buffer.from(JSON.parse(require("fs").readFileSync(process.env.HOME+"/.codex/auth.json")).tokens.id_token.split(".")[1],"base64")).email)'