perf: count bot comments without a filtered array (#20343)

Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
OrcaWin
2026-09-12 18:12:10 -07:00
committed by GitHub
co-authored by Orca Worker
parent 3c7c846a1d
commit dcc1f90125
+6 -1
View File
@@ -55,7 +55,12 @@ export function getPRCommentAudienceCounts(
comments: readonly PRComment[],
botAuthorOverrides?: ReadonlySet<string>
): Record<PRCommentAudienceFilter, number> {
const bot = comments.filter((comment) => isBotPRComment(comment, botAuthorOverrides)).length
let bot = 0
comments.forEach((comment) => {
if (isBotPRComment(comment, botAuthorOverrides)) {
bot += 1
}
})
return { all: comments.length, human: comments.length - bot, bot }
}