Files
ai-code-review/action.yml
T
JefferyandClaude Opus 4.8 d3a09d892e feat(push-token): 新增 push-token 輸入以 PAT 推送結果 commit 觸發 CI
以自動 token(gitea.token/GITHUB_TOKEN)推送的 commit 不會再觸發 CI,導致新 head 缺檢查而卡合併;新增 push-token(PAT)由呼叫端以 secrets 傳入,改以 PAT 身分推送使 PR synchronize 事件再觸發 CI,由步驟 1 快速回報把結果蓋到新 head。留空=退回 token 走 origin 推送。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 15:00:23 +08:00

65 lines
4.4 KiB
YAML
Raw 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.
# ============================================================================
# 用途:定義 AI Code Review Node action 的名稱、輸入參數與 Node.js 24 進入點,供 Gitea / GitHub workflow 以 uses 引用。
# 更新時間:2026/07/17 18:49:58
# ============================================================================
# Gitea / GitHub node action 的 manifestaction.yml):
# 定義本 action 的名稱、說明、輸入參數(inputs)與執行方式(runs),
# 供呼叫端 workflow 以 `uses:` 引用;runner 讀取此檔後以 node24 執行 src/index.js。
# action 顯示名稱:呼叫端 workflow log 與 marketplace 列表上看到的名稱。
name: 'AI Code Review'
# action 用途說明:多角色 AI code review 流程(攻擊方找問題、防守方裁決誤報),
# 審查結果會留言到 PR 並保存 findings.gitea/ai-review/findings/)。
description: 'AI 多角色 code review:攻擊方找問題、防守方裁決誤報,結果留言到 PR 並保存 findings'
# action 作者資訊(僅供辨識,不影響執行)。
author: 'Jeffery'
# 輸入參數區塊:呼叫端 workflow 以 `with:` 傳入,
# runner 會自動注入為 INPUT_* 環境變數(例如 INPUT_TOKEN、INPUT_MODEL、INPUT_CREATE-ISSUE)供主程式讀取。
inputs:
# Gitea API token:用於對 PR 留言審查結果、以及 push 審查結果檔回 repo。
token:
# 參數用途說明:secrets/vars context 在 action 內不可用,
# 故由呼叫端 workflow 以 secrets.GITHUB_TOKEN 傳入。
description: 'Gitea API tokenPR 留言與 push findings 用;呼叫端以 secrets.GITHUB_TOKEN 傳入)'
# 必填:缺少 token 無法呼叫 Gitea APIaction 無法運作。
required: true
# 指定 AI 工具使用的模型名稱。
model:
# 參數用途說明:留空表示使用各 AI 工具自身的預設模型。
description: '指定 AI 工具使用的模型(空值=各工具預設)'
# 選填:未指定時採用預設值。
required: false
# 預設為空字串,代表不覆寫各工具的預設模型。
default: ''
# 建問題模式開關:是否把審查保留的問題另建 issue 追蹤。
create-issue:
# 參數用途說明:字串 'true' 時建立 issue(標題=PR 標題、描述=PR 描述、AI 挑標籤),
# 並逐條留言問題明細,findings 檔不進版控、收尾只 commit exclusions.json
# 預設 'false' 走原流程(findings 檔與 exclusions.json 一併 commit 回 PR 來源分支)。
description: '是否將問題建到存取庫的問題追蹤(true 時建立 issue 逐條留言問題明細,最後只 commit exclusions.json;預設 false 走原流程)'
# 選填:未指定時採用預設值。
required: false
# 預設為字串 'false',代表不啟用建問題模式(主程式只認字串 'true' 才啟用)。
default: 'false'
# 推送用 PAT:推送 findings/exclusions commit 時改以此 token 進行。
push-token:
# 參數用途說明:以自動 tokengitea.token / GITHUB_TOKEN)推送的 commit 不會再觸發 CI,
# 導致新 head 缺檢查而卡合併;改用 PAT 推送會讓 PR 的 synchronize 事件再觸發 CI
# 由主程式步驟 1 快速回報([success]/[failure])廉價地把結果蓋到新 head。
# 呼叫端以 secrets 傳入(例如 secrets.TOKEN)。留空=退回以 token 走 origin 推送(不會再觸發)。
description: '推送 findings/exclusions commit 用的 PAT(讓 CI 再觸發;呼叫端以 secrets 傳入;留空=退回 token 推送、不再觸發)'
# 選填:未指定時退回以 token 推送。
required: false
# 預設為空字串,代表不使用專用推送 PAT。
default: ''
# 執行方式區塊:宣告本 action 為 node action 及其進入點。
runs:
# 以 Node.js 24 runtime 直接在 runner 上執行(非 Docker 容器、非 composite)。
using: 'node24'
# 主程式進入點:直接指向 src/index.jsentry point)。
# 主程式為零外部相依(package.json 無 dependenciessrc 僅 require Node 內建模組與本地 lib),
# runner 不會自動 npm install,零相依時依 node action 慣例 main 直接指向 src/index.js 即正確;
# 日後若新增外部相依,需改以 @vercel/ncc 打包(package.json 已備有 build script),
# 並將 main 改指 dist/index.js、把 dist/ commit 進 repo。
main: 'src/index.js'