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

PRs in the CHANGES_REQUESTED state need to be treated as "not approved" #55

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 11 additions & 4 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.

15 changes: 11 additions & 4 deletions src/functions/prechecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ export async function prechecks(
// CI checks are set to be bypassed and the PR has not been reviewed
} else if (
commitStatus === 'skip_ci' &&
reviewDecision === 'REVIEW_REQUIRED'
(reviewDecision === 'REVIEW_REQUIRED' ||
reviewDecision === 'CHANGES_REQUESTED')
) {
message = `### ⚠️ Cannot proceed with operation\n\n> CI checks are not required for this operation but the PR has not been reviewed`
return {message: message, status: false}
Expand All @@ -257,7 +258,8 @@ export async function prechecks(

// If CI is passing but the PR has not been reviewed
} else if (
reviewDecision === 'REVIEW_REQUIRED' &&
(reviewDecision === 'REVIEW_REQUIRED' ||
reviewDecision === 'CHANGES_REQUESTED') &&
commitStatus === 'SUCCESS'
) {
message = `### ⚠️ Cannot proceed with operation\n\n> CI checks are passing but the PR has not been reviewed`
Expand All @@ -270,7 +272,8 @@ export async function prechecks(

// If CI is pending and the PR has not been reviewed
} else if (
reviewDecision === 'REVIEW_REQUIRED' &&
(reviewDecision === 'REVIEW_REQUIRED' ||
reviewDecision === 'CHANGES_REQUESTED') &&
commitStatus === 'PENDING'
) {
message = `### ⚠️ Cannot proceed with operation\n\n- reviewDecision: \`${reviewDecision}\`\n- commitStatus: \`${commitStatus}\`\n\n> CI is still in a pending state and reviews are also required for this operation`
Expand All @@ -282,7 +285,11 @@ export async function prechecks(
return {message: message, status: false}

// If CI is undefined and the PR has not been reviewed
} else if (reviewDecision === 'REVIEW_REQUIRED' && commitStatus === null) {
} else if (
(reviewDecision === 'REVIEW_REQUIRED' ||
reviewDecision === 'CHANGES_REQUESTED') &&
commitStatus === null
) {
message = `### ⚠️ Cannot proceed with operation\n\n- reviewDecision: \`${reviewDecision}\`\n- commitStatus: \`${commitStatus}\`\n\n> CI checks have not been defined but reviews are required for this operation`
return {message: message, status: false}

Expand Down
Loading