Skip to content

Commit

Permalink
SWI-2286 Ignore SDLC Check Requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrice6713 committed Apr 6, 2023
1 parent bd1942d commit 9b4b912
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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."
);
Expand All @@ -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
);
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9b4b912

Please sign in to comment.