Skip to content

Commit

Permalink
Change skip condition
Browse files Browse the repository at this point in the history
  • Loading branch information
chabou committed Jan 24, 2021
1 parent 372f69c commit 763c468
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@ async function getUniqueReviews(pullRequestNumber: number): Promise<Reviews> {
pull_number: pullRequestNumber
})
const uniqueByUserReviews: Reviews = []
for (const review of reviews.reverse()) {
for (const candidate of reviews
.filter(review => ['CHANGES_REQUESTED', 'APPROVED'].includes(review.state))
.reverse()) {
if (
!uniqueByUserReviews.find(
uniqueReview =>
review.user && uniqueReview.user?.login === review.user.login
candidate.user && uniqueReview.user?.login === candidate.user.login
)
) {
uniqueByUserReviews.push(review)
uniqueByUserReviews.push(candidate)
}
}
return uniqueByUserReviews
Expand Down

0 comments on commit 763c468

Please sign in to comment.