Do not consider PR in test if there is any review requesting changes

This commit is contained in:
Pedro Pombeiro 2018-01-23 17:06:28 +01:00
parent 8e0298c830
commit d4f5a453f8
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 9 additions and 6 deletions

View File

@ -35,7 +35,10 @@ async function getReviewApprovalState(github, payload) {
const ghreviews = await github.pullRequests.getReviews({owner: ownerName, repo: repoName, number: prNumber})
const approvedReviews = ghreviews.data.filter(review => review.state === 'APPROVED')
if (approvedReviews.length >= 2) {
return 'approved'
const reviewsWithChangesRequested = ghreviews.data.filter(review => review.state === 'CHANGES_REQUESTED')
if (reviewsWithChangesRequested.length == 0) {
return 'approved'
}
}
return 'pending'