fix(評論發布): 只統計新問題並排序 comments
AI / 計算版本號 (pull_request) Successful in 2s
AI / Code Review (pull_request) Successful in 1m13s

This commit is contained in:
2026-06-22 23:02:21 +08:00
parent d04a256a3b
commit 279bcc2101
3 changed files with 20 additions and 9 deletions
+12 -7
View File
@@ -84,16 +84,21 @@ function toReviewComment(f) {
}
/**
* 發布單一 Gitea review本文統計可找出檔案與行數的問題,
* comments 只包含可定位到檔案與行數的 findings,並依嚴重等級排序。
* 發布單一 Gitea review
* - summaryFindings 只用來統計本文數字
* - commentFindings 用來產生 review comments,並依嚴重等級排序
*/
export async function postFindingsReview(findings, deps = {}) {
const { postReview = postPullReview } = deps;
const sorted = [...findings].sort(bySeverity);
const comments = sorted.map(toReviewComment).filter(Boolean);
const body = buildReviewSummary(sorted);
const {
postReview = postPullReview,
summaryFindings = findings,
commentFindings = findings,
} = deps;
const sortedComments = [...commentFindings].sort(bySeverity);
const comments = sortedComments.map(toReviewComment).filter(Boolean);
const body = buildReviewSummary(summaryFindings);
await postReview({ body, comments });
ok(`review 發布: total=${sorted.length} commentable=${comments.length}`);
ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);
}
/**