docs(指令檔與 README): 補齊 action 與 workflow 逐行註解並新增專案 README
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# setup-codex
|
||||
|
||||
> 更新時間:2026/07/03 11:45:51
|
||||
|
||||
`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 與少量 shell/Node,**不含可列入 README 的公開程式方法**。
|
||||
|
||||
## 專案列表
|
||||
|
||||
### 專案描述
|
||||
|
||||
| 專案名稱 | 專案描述 |
|
||||
| --- | --- |
|
||||
| [setup-codex](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop) | Gitea composite action:安裝 Codex CLI、以 base64 編碼的 OAuth 驗證檔完成登入,並顯示目前登入帳號;另附 CI(PR 發佈 Release + 執行 action)與 CD(push master 反查 commit tag)示範 workflow。 |
|
||||
|
||||
### 參考專案
|
||||
|
||||
| 專案名稱 | 參考專案列表 |
|
||||
| --- | --- |
|
||||
| [setup-codex](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop) | 無 |
|
||||
|
||||
### NuGet 套件
|
||||
|
||||
| 專案名稱 | NuGet 套件列表 |
|
||||
| --- | --- |
|
||||
| [setup-codex](https://gitea.jsc.idv.tw/actions/setup-codex/src/branch/develop) | 無 |
|
||||
|
||||
## 功能列表
|
||||
|
||||
本專案為 Gitea composite action(YAML + shell/Node),未公開任何可列入 README 的程式方法(public method/constructor/extension method/operator)。
|
||||
|
||||
| 功能名稱 | 功能描述 |
|
||||
| --- | --- |
|
||||
| (無) | 此專案未公開可列入 README 的功能。 |
|
||||
|
||||
## 使用範例
|
||||
|
||||
> 說明:本專案無公開程式方法,以下改以「如何在 workflow 中使用此 composite action」作為使用範例。
|
||||
|
||||
### 在 workflow 中引用 action
|
||||
|
||||
在同一個 repo 內,可用相對路徑 `./` 引用本 action;跨 repo 則以 `owner/repo@版本` 引用。此 action 需要一個必填參數 `oauth`(透過 OAuth 登入 ChatGPT 產生、並經 base64 編碼的驗證檔內容,建議存放於 secrets)。
|
||||
|
||||
```yaml
|
||||
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 "請你進行自我介紹"
|
||||
```
|
||||
|
||||
**前置條件與注意事項**
|
||||
|
||||
- `oauth`:必填。內容為 Codex/ChatGPT OAuth 驗證檔(`auth.json`)先經 base64 編碼後的字串,請存於 secret(例如 `CODEX_OAUTH`)避免外洩。
|
||||
- action 會在 runner 家目錄產生 `~/.codex/auth.json`(含機敏憑證),並將 Codex 執行檔目錄加入 `PATH`。
|
||||
- action 內建的 `Show Codex Account` 步驟會將登入帳號的 email 輸出到 workflow log,請留意 log 的存取權限與隱私。
|
||||
|
||||
### 對應的 workflow 檔案
|
||||
|
||||
| 檔案 | 觸發時機 | 用途 |
|
||||
| --- | --- | --- |
|
||||
| [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) | Pull Request `opened`/`synchronize` | 發佈 beta Release、執行本 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 並顯示。 |
|
||||
Reference in New Issue
Block a user