docs(release-cleanup): 補上 index.js JSDoc 與 ci/cd workflow 註解
CI / AI Code Review (pull_request) Failing after 40s
CI / AI Code Review (pull_request) Failing after 40s
為進入點主流程 main() 補上 JSDoc;為 ci.yaml/cd.yaml 加上用途說明與逐行註解。 皆為註解變更,不影響任何執行邏輯。 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
15ffa4ffb6
commit
4bcc6a5014
@@ -1,12 +1,27 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# 用途: release-cleanup 專案的 CD workflow。
|
||||||
|
# 在程式碼推送至 master 分支時,自動釋出並標註 (tag) 成品版本。
|
||||||
|
# 更新日期: 2026/06/26 10:28:36
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# workflow 名稱,顯示於 Gitea Actions 介面。
|
||||||
name: CD
|
name: CD
|
||||||
|
# 觸發條件設定。
|
||||||
on:
|
on:
|
||||||
|
# 於 push 事件觸發。
|
||||||
push:
|
push:
|
||||||
|
# 僅在推送至 master 分支時觸發。
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
|
# job 識別碼:釋出並標註版本。
|
||||||
release-tag-version:
|
release-tag-version:
|
||||||
|
# job 顯示名稱。
|
||||||
name: Release Tag Version
|
name: Release Tag Version
|
||||||
|
# 指定執行於 ubuntu runner。
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
steps:
|
steps:
|
||||||
|
# 呼叫共用的 release-tag-version composite action,自動產生版本標籤並釋出。
|
||||||
- name: 釋出並標註成品版本
|
- name: 釋出並標註成品版本
|
||||||
|
# 版本以變數 ACTION_RELEASE_TAG_VERSION 控制,便於統一升級。
|
||||||
uses: https://gitea.jsc.idv.tw/composite-actions/release-tag-version@${{ vars.ACTION_RELEASE_TAG_VERSION }}
|
uses: https://gitea.jsc.idv.tw/composite-actions/release-tag-version@${{ vars.ACTION_RELEASE_TAG_VERSION }}
|
||||||
|
|||||||
@@ -1,19 +1,40 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# 用途: release-cleanup 專案的 CI workflow。
|
||||||
|
# 在 Pull Request 開啟或更新時,觸發 OpenCode AI 程式碼審查。
|
||||||
|
# 更新日期: 2026/06/26 10:28:36
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
# workflow 名稱,顯示於 Gitea Actions 介面。
|
||||||
name: CI
|
name: CI
|
||||||
|
# 觸發條件設定。
|
||||||
on:
|
on:
|
||||||
|
# 於 Pull Request 事件觸發。
|
||||||
pull_request:
|
pull_request:
|
||||||
|
# 忽略目標分支為 master 的 PR (master 走 CD 流程,不在此審查)。
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- master
|
- master
|
||||||
|
# 僅在 PR 開啟 (opened) 或有新 commit 推送 (synchronize) 時觸發。
|
||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
jobs:
|
jobs:
|
||||||
|
# job 識別碼:AI 程式碼審查。
|
||||||
ai-code-review:
|
ai-code-review:
|
||||||
|
# job 顯示名稱。
|
||||||
name: AI Code Review
|
name: AI Code Review
|
||||||
|
# 指定執行於 ubuntu runner。
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
|
# 此 job 所需的權限 (供 AI 寫回審查結果)。
|
||||||
permissions:
|
permissions:
|
||||||
|
# 可寫入儲存庫內容。
|
||||||
contents: write
|
contents: write
|
||||||
|
# 可在 PR 上留言/變更狀態。
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
# 可建立/更新 issue。
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
|
# 呼叫共用的 OpenCode 程式碼審查 composite action。
|
||||||
- name: AI 程式碼審查 by OpenCode
|
- name: AI 程式碼審查 by OpenCode
|
||||||
|
# 版本以變數 ACTION_OPENCODE_CODE_REVIEW_VERSION 控制,便於統一升級。
|
||||||
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/opencode-code-review@${{ vars.ACTION_OPENCODE_CODE_REVIEW_VERSION }}
|
||||||
with:
|
with:
|
||||||
|
# 傳入留言用 token (secret),供 action 在 PR 上發表審查留言。
|
||||||
comment_token: ${{ secrets.COMMENT_TOKEN }}
|
comment_token: ${{ secrets.COMMENT_TOKEN }}
|
||||||
|
|||||||
@@ -6,6 +6,14 @@ import { cleanupReleases } from './releases.js'
|
|||||||
import { cleanupOrphanTags } from './tags.js'
|
import { cleanupOrphanTags } from './tags.js'
|
||||||
import { separator, fail } from './logger.js'
|
import { separator, fail } from './logger.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action 主流程:讀取並驗證環境設定、建立帶認證的 Gitea 客戶端,
|
||||||
|
* 先清理超出保留數量的舊 release,再清理未被任何 release 指定的孤立 tag,最後輸出結尾分隔線。
|
||||||
|
*
|
||||||
|
* 任一步驟拋出的例外不在此攔截,改由模組層級的 `main().catch(...)` 統一處理並以非零狀態結束。
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>} 流程完成時 resolve;設定驗證或讀取 API 失敗時 reject。
|
||||||
|
*/
|
||||||
async function main() {
|
async function main() {
|
||||||
const config = loadConfig()
|
const config = loadConfig()
|
||||||
const client = new GiteaClient({ token: config.token })
|
const client = new GiteaClient({ token: config.token })
|
||||||
|
|||||||
Reference in New Issue
Block a user