Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace PR "Request Changes" with a "API CHANGES REQUESTED" comment #163

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/api-review-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ export async function addOrUpdateAPIReviewCheck(octokit: Context['octokit'], pr:
if (!item?.body || !item.user) return items;

const changeRequest = item.state === REVIEW_STATUS.CHANGES_REQUESTED;
const approved = item.state === REVIEW_STATUS.APPROVED;
const reviewComment = lgtm.test(item.body) || decline.test(item.body);
if (!reviewComment && !changeRequest) return items;
if (!reviewComment && !changeRequest && !approved) return items;

const prev = items[item.user.id];
if (!prev) {
Expand Down Expand Up @@ -206,7 +207,9 @@ export async function addOrUpdateAPIReviewCheck(octokit: Context['octokit'], pr:
return;
}

const approved = allReviews.filter((r) => r.body?.match(lgtm)).map((r) => r.user?.login);
const approved = allReviews
.filter((r) => r.body?.match(lgtm) || r.state === REVIEW_STATUS.APPROVED)
.map((r) => r.user?.login);
const declined = allReviews.filter((r) => r.body?.match(decline)).map((r) => r.user?.login);
const requestedChanges = allReviews
.filter((r) => r.state === REVIEW_STATUS.CHANGES_REQUESTED)
Expand Down