refactor(ai-review 統計): 精簡 action log 統計輸出
This commit is contained in:
+9
-4
@@ -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)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user