Files
setup-codex/.gitea/workflows/ci.yaml
JefferyandClaude Fable 5 4127833c20 chore(gitea 工作流): 改用共用 scoped workflows,ci.yaml 改為 codex 自測流程
共同的 CI / CD(版本計算、release 發佈、AI Code Review、tag 反查、release 清理)
改由 composite-template 的 scoped workflows 自動套用;本 repo 僅保留 codex CLI
安裝與實測的自測流程(workflow 名稱同為 CI,僅 develop 的 PR 執行),
並移除功能已被共用流程覆蓋的 master.yaml。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 14:58:37 +08:00

69 lines
2.6 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# setup-codex 專案自測工作流
#
# 共同的 CI / CD 流程(版本計算、release 發佈、AI Code Review、tag 反查、
# release 清理)由 actions/composite-template 的 scoped workflows 自動套用,
# 本檔只保留 setup-codex 專屬的自測步驟,與共用流程並行執行:
# 以本 repo 根目錄的 composite action./)安裝 codex CLI
# 再執行 codex exec 產生自我介紹,驗證安裝與認證成功。
#
# 參數優先權:${{ gitea.* }} -> ${{ vars.* }}(比照共用工作流,不使用 env 傳參)
# =============================================================================
# 名稱與共用工作流同為 CI(Gitea 以檔案路徑識別 workflow,名稱重複不會衝突;
# UI 上兩條 run 同名,可由 job 組成區分:共用版有 BUILD job,自測版只有 TEST / RESULT)。
name: CI
on:
# 與共用 CI 相同的觸發條件,僅在 PR 開啟與同步更新時執行。
pull_request:
branches:
- master
- develop
types: [opened, synchronize]
jobs:
# ---- Job 1TEST(安裝 codex CLI 並實際執行)----
test:
name: TEST
runs-on: ubuntu
# 比照共用 CI 的 beta 判斷:只有目標分支為 develop 的 PR 才自測。
if: ${{ gitea.base_ref == 'develop' }}
outputs:
# 將 codex 的回覆往下傳給 result job。
message: ${{ steps.execute.outputs.message }}
steps:
# 取出原始碼,讓 uses: ./ 能找到本 repo 的 composite action。
- name: Source Code Checkout
uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
# 執行本 repo 的 composite action(即 setup-codex 自身)。
- name: Run Setup Codex
id: setup-codex
uses: ./
with:
oauth: ${{ secrets.CODEX_OAUTH }}
# 實際呼叫 codex 產生自我介紹,以 heredoc 寫入多行 output。
- name: Execute Codex
id: execute
shell: bash
run: |
MESSAGE=$(codex exec "請你進行自我介紹" 2>/dev/null)
{
echo "message<<CODEX_EOF"
echo "$MESSAGE"
echo "CODEX_EOF"
} >> "$GITHUB_OUTPUT"
# ---- Job 2RESULT(輸出 codex 回覆)----
result:
name: RESULT
runs-on: ubuntu
needs: [test]
steps:
# 這裡例外使用 step 層 env 中轉:message 為多行且可能含引號等特殊字元,
# 直接內嵌到 run 會破壞 shell 語法,經環境變數傳遞才安全。
- name: Show Message
env:
MESSAGE: ${{ needs.test.outputs.message }}
run: echo "$MESSAGE"