docs(setup-codex): 重整 action、workflow 與 README 文件
CI / 1. BUILD (pull_request) Successful in 4s
CI / 2. TEST (pull_request) Has been skipped
CI / 3. RESULT (pull_request) Has been skipped

This commit is contained in:
2026-07-11 10:44:30 +00:00
parent 7dd989fcd9
commit 18b226906f
4 changed files with 107 additions and 31 deletions
+14 -19
View File
@@ -1,8 +1,8 @@
# setup-codex
> 更新時間:2026/07/03 17:56:45
> 更新時間:2026/07/11 18:39:51Asia/Taipei
`setup-codex` 是一個 **Gitea composite action**,用於在 Gitea Actions runner 上安裝並登入 [Codex CLI](https://chatgpt.com/codex),讓後續 workflow 步驟能直接呼叫已完成 OAuth 登入的 `codex` 指令。本 repo 由 action 定義(`action.yml`)與示範用的 CI/CD workflow 組成,內容皆為 YAML 與少量 shellNode,**不含可列入 README 的公開程式方法**
`setup-codex` 是一個 **Gitea composite action**,用於在 Gitea Actions runner 上安裝並登入 [Codex CLI](https://chatgpt.com/codex),讓後續 workflow 步驟能直接呼叫已完成 OAuth 登入的 `codex` 指令。本 repo 由 action 定義(`action.yml`)與示範用的 CI/CD workflow 組成,內容皆為 YAML 與少量 shellNode。
## 專案列表
@@ -10,7 +10,7 @@
| 專案名稱 | 專案描述 |
| --- | --- |
| [setup-codex](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop) | Gitea composite action:安裝 Codex CLI、以 base64 編碼的 OAuth 驗證檔完成登入,並顯示目前登入帳號;另附 CI(僅在 base 為 masterdevelop 的 PR 觸發,發佈 Release、依 is_beta 決定是否執行 codex 測試)與 CDpush master 反查 commit tag)示範 workflow。 |
| [setup-codex](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop) | Gitea composite action:安裝 Codex CLI、以 base64 編碼的 OAuth 驗證檔完成登入,並透過 workflow 範例展示如何在 CICD 中串接 Codex。 |
### 參考專案
@@ -26,7 +26,7 @@
## 功能列表
本專案為 Gitea composite actionYAML + shellNode),未公開任何可列入 README 的程式方法public methodconstructorextension methodoperator)。
本專案未公開可列入 README 的功能public methodconstructorextension methodoperator)。
| 功能名稱 | 功能描述 |
| --- | --- |
@@ -34,8 +34,6 @@
## 使用範例
> 說明:本專案無公開程式方法,以下改以「如何在 workflow 中使用此 composite action」作為使用範例。
### 在 workflow 中引用 action
在同一個 repo 內,可用相對路徑 `./` 引用本 action;跨 repo 則以 `owner/repo@版本` 引用。此 action 需要一個必填參數 `oauth`(透過 OAuth 登入 ChatGPT 產生、並經 base64 編碼的驗證檔內容,建議存放於 secrets)。
@@ -45,17 +43,15 @@ jobs:
demo:
runs-on: ubuntu
steps:
- name: Source Code Checkout
uses: actions/checkout@v4
# 引用本 repo 根目錄的 composite action
- name: Run Setup Codex
uses: ./
with:
oauth: ${{ secrets.CODEX_OAUTH }}
# 登入完成後即可直接呼叫 codex
- name: Execute Codex
shell: bash
run: codex exec "請你進行自我介紹"
- name: Source Code Checkout
uses: actions/checkout@v4
- name: Run Setup Codex
uses: ./
with:
oauth: ${{ secrets.CODEX_OAUTH }}
- name: Execute Codex
shell: bash
run: codex exec "請你進行自我介紹"
```
**前置條件與注意事項**
@@ -63,6 +59,7 @@ jobs:
- `oauth`:必填。內容為 CodexChatGPT OAuth 驗證檔(`auth.json`)先經 base64 編碼後的字串,請存於 secret(例如 `CODEX_OAUTH`)避免外洩。
- action 會在 runner 家目錄產生 `~/.codex/auth.json`(含機敏憑證),並將 Codex 執行檔目錄加入 `PATH`
- action 內建的 `Show Codex Account` 步驟會將登入帳號的 email 輸出到 workflow log,請留意 log 的存取權限與隱私。
- `outputs.message` 目前參照的 `steps.exchange` 步驟不存在,屬於既有問題,需人工確認。
### 對應的 workflow 檔案
@@ -71,5 +68,3 @@ jobs:
| [action.yml](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop/action.yml) | 被其他 workflow 以 `uses` 引用 | 定義安裝/登入 Codex 的 composite action。 |
| [.gitea/workflows/ci.yaml](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop/.gitea/workflows/ci.yaml) | base 為 `master``develop` 的 Pull Request`opened``synchronize` | 發佈 beta Release`build``base_ref == 'develop'` 設定 `IS_BETA` 並輸出 `is_beta`,當 `is_beta == 'true'`(即 develop 的 PR)時執行本 action 以 `codex exec` 產生自我介紹、顯示結果。 |
| [.gitea/workflows/master.yaml](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop/.gitea/workflows/master.yaml) | push 至 `master` | 反查指定 commit 所屬的 git tag 並顯示。 |
> ⚠️ 注意(既有、待人工確認):`action.yml` 的 `outputs.message` 參照的 `steps.exchange` 步驟不存在,該 output 可能取不到值。