From 9b4b9127aca4735fa48e547c78c076e6d8ee0cdc Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Thu, 6 Apr 2023 11:41:52 -0400 Subject: [PATCH] SWI-2286 Ignore SDLC Check Requirement --- index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 450c11f..52946d8 100644 --- a/index.js +++ b/index.js @@ -53,8 +53,8 @@ async function pollForChecks(requiredChecks) { checkId = await getCheckRunId(requiredChecks[check].context); if (checkId == null) { currentTry += 1; - await new Promise((resolve) => - setTimeout(resolve, retryDelay * 1000) // Convert ms to seconds + await new Promise( + (resolve) => setTimeout(resolve, retryDelay * 1000) // Convert ms to seconds ); } else { currentTry = 0; @@ -69,8 +69,6 @@ async function pollForChecks(requiredChecks) { } if (requiredChecks.length != checksStatus.length) { - console.log(requiredChecks.length) - console.log(checksStatus.length) core.setFailed( "Timed out waiting for required checks to complete. Cant Auto-Merge PR." ); @@ -96,8 +94,8 @@ async function pollForChecks(requiredChecks) { break; } currentTry += 1; - await new Promise((resolve) => - setTimeout(resolve, retryDelay * 1000) // Convert ms to seconds + await new Promise( + (resolve) => setTimeout(resolve, retryDelay * 1000) // Convert ms to seconds ); } } @@ -131,7 +129,12 @@ async function main() { ); requiredChecks = branch.protection.required_status_checks.checks; - + // Remove the SDLC check from the list since it never shows up in the /check-runs API + for (check in requiredChecks) { + if ((requiredChecks[check].context = "github-sdlc-enforcer")) { + requiredChecks.splice(check, 1); + } + } if (requiredChecks.length) { global.commitId = pullRequest.head.sha; const checksStatusList = await pollForChecks(requiredChecks);