From 5a21b30e9c9a7506622ba8a262db6f426ec5c456 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 29 Jun 2026 11:59:43 +0800 Subject: [PATCH] =?UTF-8?q?docs(README):=20=E6=96=B0=E5=A2=9E=20Codex=20CL?= =?UTF-8?q?I=20composite=20action=20=E4=BD=BF=E7=94=A8=E8=AA=AA=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f59026 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# Codex CLI Composite Action + +此 repository 提供一個 Gitea/GitHub Actions composite action,用於安裝 Codex CLI、寫入 OAuth token、執行指定提示詞,並將 CLI 輸出寫入 action output。 + +## 專案列表 + +### 專案描述 + +| 專案名稱 | 專案描述 | +| --- | --- | +| [codex](https://gitea.jsc.idv.tw/composite-actions/codex) | 提供 Codex CLI composite action,讓 workflow 可透過 `oauth` 與 `prompt` 輸入執行 CLI,並從 repository variable 讀取模型名稱後取得文字輸出。 | + +### 參考專案 + +| 專案名稱 | 參考專案列表 | +| --- | --- | +| [codex](https://gitea.jsc.idv.tw/composite-actions/codex) | 無 | + +### NuGet 套件 + +| 專案名稱 | NuGet 套件列表 | +| --- | --- | +| [codex](https://gitea.jsc.idv.tw/composite-actions/codex) | 無 | + +## 功能列表 + +此 repository 未包含可列入 README 的 public method、public constructor、public extension method 或 public operator。 + +## 使用範例 + +### 在 workflow 中呼叫 Codex CLI + +以下範例示範在 workflow step 中呼叫此 composite action,傳入 OAuth token 與提示詞,並在後續步驟讀取 `text` output。模型名稱由 action 直接讀取 `vars.CODEX_MODEL`。 + +```yaml +- name: 執行 Codex CLI + id: codex + uses: https://gitea.jsc.idv.tw/composite-actions/codex@v1 + with: + oauth: ${{ secrets.CODEX_OAUTH }} + prompt: "請自我介紹" + +- name: 使用輸出文字 + run: printf '%s\n' '${{ steps.codex.outputs.text }}' +``` + +前置條件: + +- `secrets.CODEX_OAUTH` 必須是 Codex OAuth token 檔案內容的 base64 字串。 +- `vars.CODEX_MODEL` 必須是 Codex CLI 可用的模型名稱。 +- runner 必須可透過 npm 安裝 `@openai/codex`。 + +預期結果: + +- action 會安裝 `codex` CLI。 +- action 會將 OAuth token 寫入 `$HOME/.codex/auth.json` 並設定檔案權限為 `600`。 +- action 會執行 `codex exec --model "$MODEL" "$PROMPT"`,並把 stdout 寫入 `steps.codex.outputs.text`。