Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 56173d9

Browse files
authored
add comment counts in review summary (#398)
1 parent e371e3a commit 56173d9

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

dist/index.js

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/review.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,19 @@ Files that changed from the base of the PR and between ${highestReviewedCommitId
268268
context.payload.pull_request.head.sha
269269
} commits.
270270
</details>
271+
${
272+
filesAndChanges.length > 0
273+
? `
271274
<details>
272275
<summary>Files selected (${filesAndChanges.length})</summary>
273276
274-
${filesAndChanges
275-
.map(([filename, , , patches]) => `* ${filename} (${patches.length} hunks)`)
276-
.join('\n')}
277+
* ${filesAndChanges
278+
.map(([filename, , , patches]) => `${filename} (${patches.length})`)
279+
.join('\n* ')}
277280
</details>
281+
`
282+
: ''
283+
}
278284
${
279285
filterIgnoredFiles.length > 0
280286
? `
@@ -526,6 +532,8 @@ ${
526532

527533
// failed reviews array
528534
const reviewsFailed: string[] = []
535+
let lgtmCount = 0
536+
let reviewCount = 0
529537
const doReview = async (
530538
filename: string,
531539
fileContent: string,
@@ -640,6 +648,7 @@ ${commentChain}
640648
(review.comment.includes('LGTM') ||
641649
review.comment.includes('looks good to me'))
642650
) {
651+
lgtmCount += 1
643652
continue
644653
}
645654
if (context.payload.pull_request == null) {
@@ -648,6 +657,7 @@ ${commentChain}
648657
}
649658

650659
try {
660+
reviewCount += 1
651661
await commenter.bufferReviewComment(
652662
filename,
653663
review.startLine,
@@ -711,6 +721,13 @@ ${
711721
`
712722
: ''
713723
}
724+
<details>
725+
<summary>Review comments generated (${reviewCount + lgtmCount})</summary>
726+
727+
* Review: ${reviewCount}
728+
* LGTM: ${lgtmCount}
729+
730+
</details>
714731
`
715732
// add existing_comment_ids_block with latest head sha
716733
summarizeComment += `\n${commenter.addReviewedCommitId(

0 commit comments

Comments
 (0)