diff --git a/dist/check-group/core/satisfy_expected_checks.js b/dist/check-group/core/satisfy_expected_checks.js index 76538456..064e26cb 100644 --- a/dist/check-group/core/satisfy_expected_checks.js +++ b/dist/check-group/core/satisfy_expected_checks.js @@ -5,13 +5,19 @@ var getChecksResult = function (checks, postedChecks) { var result = "all_passing"; for (var _i = 0, checks_1 = checks; _i < checks_1.length; _i++) { var check = checks_1[_i]; - var relevant = check in postedChecks; - if (relevant && postedChecks[check].conclusion !== "success") { - // at least one check failed - return "has_failure"; + if (check in postedChecks) { + var conclusion = postedChecks[check].conclusion; + if (conclusion === null) { + // the check is in progress + result = "pending"; + } + else if (conclusion !== "success") { + // the check already failed + return "has_failure"; + } } - if (!relevant || postedChecks[check].conclusion === null) { - // some checks are pending or missing + else { + // the check is missing, hopefully queued result = "pending"; } } @@ -25,13 +31,19 @@ var getSubProjResult = function (subProjs, postedChecks) { var subProj = subProjs_1[_i]; for (var _a = 0, _b = subProj.checks; _a < _b.length; _a++) { var check = _b[_a]; - var relevant = check in postedChecks; - if (relevant && postedChecks[check].conclusion !== "success") { - // at least one check failed - return "has_failure"; + if (check in postedChecks) { + var conclusion = postedChecks[check].conclusion; + if (conclusion === null) { + // the check is in progress + result = "pending"; + } + else if (conclusion !== "success") { + // the check already failed + return "has_failure"; + } } - if (!relevant || postedChecks[check].conclusion === null) { - // some checks are pending or missing + else { + // the check is missing, hopefully queued result = "pending"; } } diff --git a/src/check-group/core/satisfy_expected_checks.ts b/src/check-group/core/satisfy_expected_checks.ts index 87e504ee..17a73c4c 100644 --- a/src/check-group/core/satisfy_expected_checks.ts +++ b/src/check-group/core/satisfy_expected_checks.ts @@ -6,13 +6,17 @@ export const getChecksResult = ( ): CheckResult => { let result: CheckResult = "all_passing"; for (const check of checks) { - const relevant = check in postedChecks - if (relevant && postedChecks[check].conclusion !== "success") { - // at least one check failed - return "has_failure"; - } - if (!relevant || postedChecks[check].conclusion === null) { - // some checks are pending or missing + if (check in postedChecks) { + const conclusion = postedChecks[check].conclusion; + if (conclusion === null) { + // the check is in progress + result = "pending"; + } else if (conclusion !== "success") { + // the check already failed + return "has_failure"; + } + } else { + // the check is missing, hopefully queued result = "pending"; } }; @@ -26,13 +30,17 @@ export const getSubProjResult = ( let result: CheckResult = "all_passing"; for (const subProj of subProjs) { for (const check of subProj.checks) { - const relevant = check in postedChecks - if (relevant && postedChecks[check].conclusion !== "success") { - // at least one check failed - return "has_failure"; - } - if (!relevant || postedChecks[check].conclusion === null) { - // some checks are pending or missing + if (check in postedChecks) { + const conclusion = postedChecks[check].conclusion; + if (conclusion === null) { + // the check is in progress + result = "pending"; + } else if (conclusion !== "success") { + // the check already failed + return "has_failure"; + } + } else { + // the check is missing, hopefully queued result = "pending"; } };