ci(release-cleanup): ci.yaml 改為 PR 觸發 beta 標版 + 自我清理管線
- release-tag-version job:以 is_beta: true 標註 beta 版並輸出 version - release-cleanup job:needs 前者,於該 beta 版本上執行 release-cleanup action(dogfooding 自我清理) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
15381d07a7
commit
a9b9f95a72
+27
-24
@@ -19,30 +19,33 @@ on:
|
|||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
# 定義所有 jobs
|
# 定義所有 jobs
|
||||||
jobs:
|
jobs:
|
||||||
# job 識別碼:AI 程式碼審查
|
# 第一個 job: 釋出並標註成品版本,並將版本號往外拋給後續 job 使用。
|
||||||
ai-code-review:
|
release-tag-version:
|
||||||
# job 顯示名稱
|
# job 顯示名稱。
|
||||||
name: AI Code Review
|
name: Release Tag Version
|
||||||
# 指定執行環境(runner 標籤),使用 ubuntu runner
|
# 指定執行環境 (runner) 標籤為 ubuntu。
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
# 此 job 對 GITHUB_TOKEN 所需的權限範圍
|
# 宣告此 job 的輸出,供後續 needs 此 job 的其他 job 取用。
|
||||||
permissions:
|
outputs:
|
||||||
# 允許寫入 repository 內容(供 action 讀取/操作程式碼)
|
# 將下方 id 為 release-tag-version 的 step 所輸出的 version,設為此 job 的對外 version 輸出 (關鍵點: 透過 outputs 把標註出的版本往外拋)。
|
||||||
contents: write
|
version: ${{ steps.release-tag-version.outputs.version }}
|
||||||
# 允許寫入 Pull Request(供 action 回貼審查留言)
|
# 此 job 依序執行的步驟。
|
||||||
pull-requests: write
|
|
||||||
# 允許寫入 issues(PR 留言底層走 issue comment API,需此權限)
|
|
||||||
issues: write
|
|
||||||
# 此 job 的執行步驟
|
|
||||||
steps:
|
steps:
|
||||||
# 步驟名稱:使用 OpenCode 進行 AI 程式碼審查
|
# 步驟: 呼叫 composite action 進行釋出並標註成品版本。
|
||||||
- name: AI 程式碼審查 by OpenCode
|
- name: 釋出並標註成品版本
|
||||||
# 引用公司 Gitea 上的 composite action `opencode-code-review`,
|
# 設定此 step 的 id,讓上方 outputs 可用 steps.release-tag-version.outputs.version 取得其輸出。
|
||||||
# 版本由 repository/organization 變數 ACTION_OPENCODE_CODE_REVIEW_VERSION 指定,
|
id: release-tag-version
|
||||||
# 便於集中控管所使用的 action 版本
|
# 引用 release-tag-version composite action,版本以變數 vars.ACTION_RELEASE_TAG_VERSION 釘選 (集中於 repo/org 變數管理,便於統一升版)。
|
||||||
uses: https://gitea.jsc.idv.tw/composite-actions/opencode-code-review@${{ vars.ACTION_OPENCODE_CODE_REVIEW_VERSION }}
|
uses: https://gitea.jsc.idv.tw/composite-actions/release-tag-version@${{ vars.ACTION_RELEASE_TAG_VERSION }}
|
||||||
# 傳遞給 composite action 的輸入參數
|
# 傳遞給該 action 的輸入參數。
|
||||||
with:
|
with:
|
||||||
# 留言用 token,從 secrets.COMMENT_TOKEN 取得,
|
# is_beta 設為 true 表示走 beta 標版流程 (標註的是 beta 成品版本,而非正式版)。
|
||||||
# 供 action 以該身分將審查結果回貼到 PR 留言
|
is_beta: true
|
||||||
comment_token: ${{ secrets.COMMENT_TOKEN }}
|
release-cleanup:
|
||||||
|
name: Release Cleanup
|
||||||
|
runs-on: ubuntu
|
||||||
|
needs: release-tag-version
|
||||||
|
steps:
|
||||||
|
- name: 清理舊成品
|
||||||
|
uses: https://gitea.jsc.idv.tw/docker-actions/release-cleanup@v${{ needs.release-tag-version.outputs.version }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user