correcting bug with async env

pull/496/head
Frostebite 2023-01-20 23:15:56 +00:00
parent e334dc785a
commit 875979c2d7
5 changed files with 20 additions and 6 deletions

11
dist/index.js generated vendored
View File

@ -1008,7 +1008,14 @@ const local_1 = __importDefault(__nccwpck_require__(66575));
const docker_1 = __importDefault(__nccwpck_require__(42802));
const github_1 = __importDefault(__nccwpck_require__(83654));
const shared_workspace_locking_1 = __importDefault(__nccwpck_require__(87562));
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
class CloudRunner {
static get isCloudRunnerEnvironment() {
return process.env.cloudRunnerCluster !== undefined && process.env.cloudRunnerCluster !== `local`;
}
static get isCloudRunnerAsyncEnvironment() {
return CloudRunner.isCloudRunnerEnvironment && cloud_runner_options_1.default.asyncCloudRunner;
}
static setup(buildParameters) {
cloud_runner_logger_1.default.setup();
cloud_runner_logger_1.default.log(`Setting up cloud runner`);
@ -6419,7 +6426,7 @@ class GitHub {
}
static createGitHubCheck(summary) {
return __awaiter(this, void 0, void 0, function* () {
if (!cloud_runner_options_1.default.githubChecks) {
if (!cloud_runner_options_1.default.githubChecks || !cloud_runner_1.default.isCloudRunnerEnvironment) {
return ``;
}
GitHub.startedDate = new Date().toISOString();
@ -6484,7 +6491,7 @@ class GitHub {
data.completed_at = GitHub.endedDate || GitHub.startedDate;
data.conclusion = result;
}
if (yield cloud_runner_options_1.default.asyncCloudRunner) {
if (cloud_runner_1.default.isCloudRunnerEnvironment || cloud_runner_1.default.isCloudRunnerAsyncEnvironment) {
yield GitHub.runUpdateAsyncChecksWorkflow(data, `update`);
return;
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -242,7 +242,7 @@ class CloudRunnerOptions {
return CloudRunnerOptions.getInput(`watchToEnd`) || true;
}
static get asyncCloudRunner(): boolean {
public static get asyncCloudRunner(): boolean {
return (CloudRunnerOptions.getInput('asyncCloudRunner') || `false`) === `true` || false;
}

View File

@ -15,6 +15,7 @@ import LocalCloudRunner from './providers/local';
import LocalDockerCloudRunner from './providers/docker';
import GitHub from '../github';
import SharedWorkspaceLocking from './services/shared-workspace-locking';
import CloudRunnerOptions from './cloud-runner-options';
class CloudRunner {
public static Provider: ProviderInterface;
@ -24,6 +25,12 @@ class CloudRunner {
static lockedWorkspace: string | undefined;
public static readonly retainedWorkspacePrefix: string = `retained-workspace`;
public static githubCheckId;
public static get isCloudRunnerEnvironment() {
return process.env.cloudRunnerCluster !== undefined && process.env.cloudRunnerCluster !== `local`;
}
public static get isCloudRunnerAsyncEnvironment() {
return CloudRunner.isCloudRunnerEnvironment && CloudRunnerOptions.asyncCloudRunner;
}
public static setup(buildParameters: BuildParameters) {
CloudRunnerLogger.setup();
CloudRunnerLogger.log(`Setting up cloud runner`);

View File

@ -44,7 +44,7 @@ class GitHub {
}
public static async createGitHubCheck(summary) {
if (!CloudRunnerOptions.githubChecks) {
if (!CloudRunnerOptions.githubChecks || !CloudRunner.isCloudRunnerEnvironment) {
return ``;
}
GitHub.startedDate = new Date().toISOString();
@ -114,7 +114,7 @@ class GitHub {
data.conclusion = result;
}
if (await CloudRunnerOptions.asyncCloudRunner) {
if (CloudRunner.isCloudRunnerEnvironment || CloudRunner.isCloudRunnerAsyncEnvironment) {
await GitHub.runUpdateAsyncChecksWorkflow(data, `update`);
return;