Skip to content

Commit

Permalink
[Fix] display review status first as output now shows check status
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Ranger11 committed Apr 20, 2022
1 parent 89a12f4 commit f4a5f3b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions utils/evaluatePullRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ module.exports = function evaluatePullRequest(response, requiredChecks) {
if (!doesPRHaveConflicts(response)) {
return pullRequestStatus.CONFLICT;
}

if (reviewDecision === 'CHANGES_REQUESTED') {
return pullRequestStatus.REVIEW_DISAPPROVED;
}

if (reviewDecision === 'REVIEW_REQUIRED') {
return viewerCanMergeAsAdmin ? pullRequestStatus.BYPASSABLE : pullRequestStatus.REVIEW_REQUIRED;
}

const { failure, pending } = evaluateChecks(response, requiredChecks);

if (failure.some((f) => f.isRequired)) {
Expand All @@ -35,11 +44,5 @@ module.exports = function evaluatePullRequest(response, requiredChecks) {
return pullRequestStatus.STATUS_PENDING;
}

if (reviewDecision === 'CHANGES_REQUESTED') {
return pullRequestStatus.REVIEW_DISAPPROVED;
} else if (reviewDecision === 'REVIEW_REQUIRED') {
return viewerCanMergeAsAdmin ? pullRequestStatus.BYPASSABLE : pullRequestStatus.REVIEW_REQUIRED;
}

return pullRequestStatus.MERGEABLE;
};

0 comments on commit f4a5f3b

Please sign in to comment.