Failover debugging.

It is indicating it is not getting Check Suite Information, which is unlikely.
This commit is contained in:
Michael J Mulligan 2021-04-07 21:10:35 +01:00
parent db5738640c
commit 4449bb8588
4 changed files with 54 additions and 40 deletions

View file

@ -6767,18 +6767,22 @@ function fetchCheckSuiteId(runId) {
.catch((e) => { .catch((e) => {
throw `Unable to fetch Workflow Run: ${e}`; throw `Unable to fetch Workflow Run: ${e}`;
}); });
if (currentRun.status === `in_progress`) { if (!currentRun) {
// The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type` throw `Unexpected error: No run returned`;
currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1; }
// The following SHOULD work, but alas if (currentRun.status !== `in_progress`) {
// currentCheckSuiteId = currentRun.check_suite_id throw `Unexpected error: Expected status of 'in_progress', got '${currentRun.status}': ` + util_1.inspect(currentRun);
if (currentCheckSuiteId <= 0) { }
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`; // The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type`
} currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1;
// The following SHOULD work, but alas
// currentCheckSuiteId = currentRun.check_suite_id
if (currentCheckSuiteId <= 0) {
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`;
} }
} }
catch (e) { catch (e) {
core.info(`::error::Error Fetching Current Run: ${e}`); core.info(`::error::Error Fetching Current Run (${runId}): ${e}`);
} }
} }
return currentCheckSuiteId; return currentCheckSuiteId;
@ -6890,7 +6894,6 @@ function resolveCheckRunId(checkRunIdent) {
} }
catch (e) { catch (e) {
core.info(`::error::Unable to resolve Check Run ID: ${e}`); core.info(`::error::Unable to resolve Check Run ID: ${e}`);
core.info(`checkRunIdent = ` + util_1.inspect(checkRunIdent));
} }
} }
} }

23
dist/pre/index.js vendored
View file

@ -6767,18 +6767,22 @@ function fetchCheckSuiteId(runId) {
.catch((e) => { .catch((e) => {
throw `Unable to fetch Workflow Run: ${e}`; throw `Unable to fetch Workflow Run: ${e}`;
}); });
if (currentRun.status === `in_progress`) { if (!currentRun) {
// The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type` throw `Unexpected error: No run returned`;
currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1; }
// The following SHOULD work, but alas if (currentRun.status !== `in_progress`) {
// currentCheckSuiteId = currentRun.check_suite_id throw `Unexpected error: Expected status of 'in_progress', got '${currentRun.status}': ` + util_1.inspect(currentRun);
if (currentCheckSuiteId <= 0) { }
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`; // The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type`
} currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1;
// The following SHOULD work, but alas
// currentCheckSuiteId = currentRun.check_suite_id
if (currentCheckSuiteId <= 0) {
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`;
} }
} }
catch (e) { catch (e) {
core.info(`::error::Error Fetching Current Run: ${e}`); core.info(`::error::Error Fetching Current Run (${runId}): ${e}`);
} }
} }
return currentCheckSuiteId; return currentCheckSuiteId;
@ -6890,7 +6894,6 @@ function resolveCheckRunId(checkRunIdent) {
} }
catch (e) { catch (e) {
core.info(`::error::Unable to resolve Check Run ID: ${e}`); core.info(`::error::Unable to resolve Check Run ID: ${e}`);
core.info(`checkRunIdent = ` + util_1.inspect(checkRunIdent));
} }
} }
} }

23
dist/run/index.js vendored
View file

@ -6777,18 +6777,22 @@ function fetchCheckSuiteId(runId) {
.catch((e) => { .catch((e) => {
throw `Unable to fetch Workflow Run: ${e}`; throw `Unable to fetch Workflow Run: ${e}`;
}); });
if (currentRun.status === `in_progress`) { if (!currentRun) {
// The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type` throw `Unexpected error: No run returned`;
currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1; }
// The following SHOULD work, but alas if (currentRun.status !== `in_progress`) {
// currentCheckSuiteId = currentRun.check_suite_id throw `Unexpected error: Expected status of 'in_progress', got '${currentRun.status}': ` + util_1.inspect(currentRun);
if (currentCheckSuiteId <= 0) { }
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`; // The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type`
} currentCheckSuiteId = (_a = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`)))) !== null && _a !== void 0 ? _a : -1;
// The following SHOULD work, but alas
// currentCheckSuiteId = currentRun.check_suite_id
if (currentCheckSuiteId <= 0) {
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`;
} }
} }
catch (e) { catch (e) {
core.info(`::error::Error Fetching Current Run: ${e}`); core.info(`::error::Error Fetching Current Run (${runId}): ${e}`);
} }
} }
return currentCheckSuiteId; return currentCheckSuiteId;
@ -6900,7 +6904,6 @@ function resolveCheckRunId(checkRunIdent) {
} }
catch (e) { catch (e) {
core.info(`::error::Unable to resolve Check Run ID: ${e}`); core.info(`::error::Unable to resolve Check Run ID: ${e}`);
core.info(`checkRunIdent = ` + util_1.inspect(checkRunIdent));
} }
} }
} }

View file

@ -117,17 +117,23 @@ async function fetchCheckSuiteId(runId: number): Promise<number> {
throw `Unable to fetch Workflow Run: ${e}` throw `Unable to fetch Workflow Run: ${e}`
}) })
if (currentRun.status === `in_progress`) { if (!currentRun) {
// The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type` throw `Unexpected error: No run returned`
currentCheckSuiteId = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`))) ?? -1 }
// The following SHOULD work, but alas
// currentCheckSuiteId = currentRun.check_suite_id if (currentRun.status !== `in_progress`) {
if (currentCheckSuiteId <= 0) { throw `Unexpected error: Expected status of 'in_progress', got '${currentRun.status}': ` + inspect(currentRun)
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}` }
}
// The GitHub API it's self does present the `check_suite_id` property, but it is not documented or present returned object's `type`
currentCheckSuiteId = parseInt(currentRun.check_suite_url.substr(1 + currentRun.check_suite_url.lastIndexOf(`/`))) ?? -1
// The following SHOULD work, but alas
// currentCheckSuiteId = currentRun.check_suite_id
if (currentCheckSuiteId <= 0) {
throw `Error extracting Check Suite ID from: ${currentRun.check_suite_url}`
} }
} catch (e) { } catch (e) {
core.info(`::error::Error Fetching Current Run: ${e}`) core.info(`::error::Error Fetching Current Run (${runId}): ${e}`)
} }
} }
return currentCheckSuiteId return currentCheckSuiteId
@ -260,7 +266,6 @@ async function resolveCheckRunId(checkRunIdent: CheckRunIdent): Promise<number>
} }
} catch (e) { } catch (e) {
core.info(`::error::Unable to resolve Check Run ID: ${e}`) core.info(`::error::Unable to resolve Check Run ID: ${e}`)
core.info(`checkRunIdent = ` + inspect(checkRunIdent))
} }
} }
} else { } else {