Move isDefaultSetup to actions-util.ts and change implementation

This commit is contained in:
Michael B. Gale 2024-07-26 13:30:15 +01:00
parent 259cc5a39c
commit 471ed9f4c5
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
6 changed files with 14 additions and 16 deletions

View file

@ -472,6 +472,11 @@ export function isSelfHostedRunner() {
return process.env.RUNNER_ENVIRONMENT === "self-hosted";
}
/** Determines whether we are running in default setup. */
export function isDefaultSetup(): boolean {
return getWorkflowEventName() === "dynamic";
}
export function prettyPrintInvocation(cmd: string, args: string[]): string {
return [cmd, ...args].map((x) => (x.includes(" ") ? `'${x}'` : x)).join(" ");
}

View file

@ -13,6 +13,7 @@ import {
getRequiredInput,
getTemporaryDirectory,
persistInputs,
isDefaultSetup,
} from "./actions-util";
import { getGitHubVersion } from "./api-client";
import { CodeQL } from "./codeql";
@ -723,13 +724,6 @@ async function recordZstdAvailability(
);
}
/** Determines whether we are running in default setup. */
function isDefaultSetup(): boolean {
// This is set to something in default setup runs.
// TODO: replace with something better, if there's something.
return process.env["CODE_SCANNING_WORKFLOW_FILE"] !== undefined;
}
/** Determines whether dependency caching is enabled. */
function getDependencyCachingEnabled(): boolean {
// If the workflow specified something always respect that