release: 將 AI 程式碼審查 action 發布到 master #2

Merged
admin merged 32 commits from develop into master 2026-07-03 10:07:51 +00:00
Showing only changes of commit 6868dbdc8f - Show all commits
+12 -6
View File
@@ -54,6 +54,9 @@ export async function getPRDiff() {
'.github/',
'README.md',
'TODO.md',
'package-lock.json',
'src/package-lock.json',
'dist/',
]);
}
@@ -126,13 +129,16 @@ export async function shouldSkipBotCommit({ sha = PR_HEAD_SHA || process.env.GIT
* @param {string[]} excludePrefixes - 要排除的路徑前綴陣列(資料夾以 `/` 結尾,如 `.gitea/`)。
* @returns {string} 過濾後重新接合的 diff 文字。
*/
export function filterDiff(diff, excludePrefixes) {
export function filterDiff(diff, excludePrefixes = []) {
return diff.split(/(?=^diff --git )/m)
.filter(block => !excludePrefixes.some(p => {
const prefix = `diff --git a/${p}`;
const singleFile = `diff --git a/${p} b/${p}`;
return block.startsWith(prefix) || block.startsWith(singleFile);
}))
.filter(block => {
const m = block.match(/^diff --git a\/(.+?) b\//);
const path = m ? m[1] : '';
if (!path) return true;
// 一律排除任何深度的 node_modulesvendored 依賴不是審查對象,且會撐爆 LLM 輸入上限。
if (/(^|\/)node_modules\//.test(path)) return false;
return !excludePrefixes.some(p => path === p || path.startsWith(p));
})
.join('');
}