Skip to content

Commit

Permalink
fix: look for API LGTM comments too
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 12, 2022
1 parent f3a252d commit c427ef7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/api-review-state.ts
Expand Up @@ -104,15 +104,27 @@ export async function addOrUpdateAPIReviewCheck(
})
).data.filter(review => members.includes(review.user.login));

const comments = (
await octokit.issues.listComments({
owner,
repo,
issue_number: pr.number,
})
).data.filter(comment => members.includes(comment.user.login));

// If the PR is semver-patch, it does not need API review.
if (!pr.labels.some(l => isSemverMajorMinorLabel(l.name))) {
await resetToNeutral();
return;
}

const users = {
approved: reviews.filter(review => review.body.match(/API LGTM/gi)).map(r => r.user.login),
declined: reviews.filter(review => review.body.match(/API DECLINED/gi)).map(r => r.user.login),
approved: [...reviews, ...comments]
.filter(item => item.body.match(/API LGTM/gi))
.map(r => r.user.login),
declined: [...reviews, ...comments]
.filter(item => item.body.match(/API DECLINED/gi))
.map(r => r.user.login),
requestedChanges: reviews
.filter(review => review.state === REVIEW_STATUS.CHANGES_REQUESTED)
.map(r => r.user.login),
Expand Down

0 comments on commit c427ef7

Please sign in to comment.