@@ -31237,7 +31237,7 @@ const getMergeableStatus = async (pullNumber) => {
31237
31237
/**
31238
31238
* whether all checks passed
31239
31239
*/
31240
- const areAllChecksPassed = async (sha) => {
31240
+ const areAllChecksPassed = async (sha, allow_ongoing_checks ) => {
31241
31241
const octokit = getOctokit();
31242
31242
const repo = github.context.repo;
31243
31243
const {
@@ -31247,11 +31247,20 @@ const areAllChecksPassed = async (sha) => {
31247
31247
ref: sha,
31248
31248
});
31249
31249
31250
- const hasUnfinishedOrFailedChecks = check_runs.some((item) => {
31251
- return item.status !== 'completed' || item.conclusion === 'failure';
31252
- });
31250
+ let hasOffensiveChecks = false;
31251
+ if (allow_ongoing_checks) {
31252
+ // check whether there are ongoing checks
31253
+ hasOffensiveChecks = check_runs.some((item) => {
31254
+ return item.conclusion === 'failure';
31255
+ });
31256
+ } else {
31257
+ // check whether there are unfinished or failed checks
31258
+ hasOffensiveChecks = check_runs.some((item) => {
31259
+ return item.status !== 'completed' || item.conclusion === 'failure';
31260
+ });
31261
+ }
31253
31262
31254
- return !hasUnfinishedOrFailedChecks ;
31263
+ return !hasOffensiveChecks ;
31255
31264
};
31256
31265
31257
31266
/**
@@ -31291,7 +31300,9 @@ const getApprovalStatus = async (pullNumber) => {
31291
31300
};
31292
31301
31293
31302
const filterApplicablePRs = (openPRs) => {
31294
- const includeNonAutoMergePRs = isStringFalse(github_core.getInput('require_auto_merge_enabled'));
31303
+ const includeNonAutoMergePRs = isStringFalse(
31304
+ github_core.getInput('require_auto_merge_enabled'),
31305
+ );
31295
31306
if (includeNonAutoMergePRs) {
31296
31307
return openPRs;
31297
31308
}
@@ -31308,6 +31319,9 @@ const getAutoUpdateCandidate = async (openPRs) => {
31308
31319
const requirePassedChecks = isStringTrue(
31309
31320
github_core.getInput('require_passed_checks'),
31310
31321
);
31322
+ const allowOngoingChecks = isStringTrue(
31323
+ github_core.getInput('allow_ongoing_checks'),
31324
+ );
31311
31325
const applicablePRs = filterApplicablePRs(openPRs);
31312
31326
31313
31327
for (const pr of applicablePRs) {
@@ -31353,9 +31367,13 @@ const getAutoUpdateCandidate = async (openPRs) => {
31353
31367
* need to note: the mergeable, and mergeable_state don't reflect the checks status
31354
31368
*/
31355
31369
if (requirePassedChecks) {
31356
- const didChecksPass = await areAllChecksPassed(sha);
31370
+ const didChecksPass = await areAllChecksPassed(sha, allowOngoingChecks);
31371
+
31372
+ const reasonType = allowOngoingChecks
31373
+ ? 'failed check(s)'
31374
+ : 'failed or ongoing check(s)';
31357
31375
if (!didChecksPass) {
31358
- printFailReason(pullNumber, ' The PR has failed or ongoing check(s)' );
31376
+ printFailReason(pullNumber, ` The PR has ${reasonType}` );
31359
31377
continue;
31360
31378
}
31361
31379
}
0 commit comments