refactor(ai-review 統計): 精簡 action log 統計輸出
AI / 計算版本號 (pull_request) Successful in 2s
AI / Code Review (pull_request) Successful in 1m26s

This commit is contained in:
2026-06-23 02:27:18 +00:00
parent 88618f364a
commit 31de74c603
3 changed files with 27 additions and 14 deletions
+9 -4
View File
@@ -77,6 +77,13 @@ export function formatFindingsStats(findings) {
].join('\n');
}
export function formatFindingsStatsLine(findings) {
const oldFindings = findings.filter(f => f.is_new === false);
const newFindings = newFindingsOnly(findings);
const row = items => `嚴重${countBy(items, f => f.level === 'critical')} / 警告${countBy(items, f => f.level === 'warning')} / 建議${countBy(items, f => f.level === 'info')}`;
return `舊: ${row(oldFindings)};新: ${row(newFindings)}`;
}
function buildReviewSummary(findings) {
return [
'## AI Code Review 統計',
@@ -111,10 +118,8 @@ export async function postFindingsReview(findings, deps = {}) {
const body = buildReviewSummary(summaryFindings);
await postReview({ body, comments });
ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);
line('review summary 統計:');
for (const row of formatFindingsStats(summaryFindings).split('\n')) line(row);
line('review comments 統計:');
for (const row of formatFindingsStats(sortedComments).split('\n')) line(row);
line(`review summary 統計: ${formatFindingsStatsLine(summaryFindings)}`);
line(`review comments 統計: ${formatFindingsStatsLine(sortedComments)}`);
}
/**