fix(評論發布): 只統計新問題並排序 comments
This commit is contained in:
+12
-7
@@ -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}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user