Skip to content

Commit 8aa56c8

Browse files
authored
Merge pull request #55 from github/changes-requested
PRs in the `CHANGES_REQUESTED` state need to be treated as "not approved"
2 parents 229efbe + af409b5 commit 8aa56c8

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

dist/index.js

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions/prechecks.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ export async function prechecks(
245245
// CI checks are set to be bypassed and the PR has not been reviewed
246246
} else if (
247247
commitStatus === 'skip_ci' &&
248-
reviewDecision === 'REVIEW_REQUIRED'
248+
(reviewDecision === 'REVIEW_REQUIRED' ||
249+
reviewDecision === 'CHANGES_REQUESTED')
249250
) {
250251
message = `### ⚠️ Cannot proceed with operation\n\n> CI checks are not required for this operation but the PR has not been reviewed`
251252
return {message: message, status: false}
@@ -257,7 +258,8 @@ export async function prechecks(
257258

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

271273
// If CI is pending and the PR has not been reviewed
272274
} else if (
273-
reviewDecision === 'REVIEW_REQUIRED' &&
275+
(reviewDecision === 'REVIEW_REQUIRED' ||
276+
reviewDecision === 'CHANGES_REQUESTED') &&
274277
commitStatus === 'PENDING'
275278
) {
276279
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`
@@ -282,7 +285,11 @@ export async function prechecks(
282285
return {message: message, status: false}
283286

284287
// If CI is undefined and the PR has not been reviewed
285-
} else if (reviewDecision === 'REVIEW_REQUIRED' && commitStatus === null) {
288+
} else if (
289+
(reviewDecision === 'REVIEW_REQUIRED' ||
290+
reviewDecision === 'CHANGES_REQUESTED') &&
291+
commitStatus === null
292+
) {
286293
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`
287294
return {message: message, status: false}
288295

0 commit comments

Comments
 (0)