diff --git a/src/analyze-action.ts b/src/analyze-action.ts index 0b71d6a90..80315e53a 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -23,7 +23,10 @@ import { Features } from "./feature-flags"; import { Language } from "./languages"; import { getActionsLogger, Logger } from "./logging"; import { parseRepositoryNwo } from "./repository"; -import { CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY } from "./shared-environment"; +import { + CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY, + CODEQL_ACTION_DID_AUTOBUILD_GOLANG, +} from "./shared-environment"; import { getTotalCacheSize, uploadTrapCaches } from "./trap-caching"; import * as upload_lib from "./upload-lib"; import { UploadResult } from "./upload-lib"; @@ -130,7 +133,7 @@ function doesGoExtractionOutputExist(config: Config): boolean { * an autobuild step or manual build steps. * * - We detect whether an autobuild step is present by checking the - * `util.DID_AUTOBUILD_GO_ENV_VAR_NAME` environment variable, which is set + * `CODEQL_ACTION_DID_AUTOBUILD_GOLANG` environment variable, which is set * when the autobuilder is invoked. * - We detect whether the Go database has already been finalized in case it * has been manually set in a prior Action step. @@ -141,7 +144,7 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) { if (!config.languages.includes(Language.go)) { return; } - if (process.env[util.DID_AUTOBUILD_GO_ENV_VAR_NAME] === "true") { + if (process.env[CODEQL_ACTION_DID_AUTOBUILD_GOLANG] === "true") { logger.debug("Won't run Go autobuild since it has already been run."); return; } diff --git a/src/autobuild-action.ts b/src/autobuild-action.ts index 4f0dd92c3..e6761de33 100644 --- a/src/autobuild-action.ts +++ b/src/autobuild-action.ts @@ -14,11 +14,8 @@ import { determineAutobuildLanguages, runAutobuild } from "./autobuild"; import * as configUtils from "./config-utils"; import { Language } from "./languages"; import { getActionsLogger } from "./logging"; -import { - DID_AUTOBUILD_GO_ENV_VAR_NAME, - checkGitHubVersionInRange, - initializeEnvironment, -} from "./util"; +import { CODEQL_ACTION_DID_AUTOBUILD_GOLANG } from "./shared-environment"; +import { checkGitHubVersionInRange, initializeEnvironment } from "./util"; interface AutobuildStatusReport extends StatusReportBase { /** Comma-separated set of languages being auto-built. */ @@ -88,7 +85,7 @@ async function run() { currentLanguage = language; await runAutobuild(language, config, logger); if (language === Language.go) { - core.exportVariable(DID_AUTOBUILD_GO_ENV_VAR_NAME, "true"); + core.exportVariable(CODEQL_ACTION_DID_AUTOBUILD_GOLANG, "true"); } } } diff --git a/src/shared-environment.ts b/src/shared-environment.ts index 25ae78315..061ca2209 100644 --- a/src/shared-environment.ts +++ b/src/shared-environment.ts @@ -1,3 +1,10 @@ +/** + * Environment variable that is set to true when the CodeQL Action has invoked + * the Go autobuilder. + */ +export const CODEQL_ACTION_DID_AUTOBUILD_GOLANG = + "CODEQL_ACTION_DID_AUTOBUILD_GOLANG"; + /** * This environment variable is set to true when the `analyze` Action * completes successfully. diff --git a/src/util.ts b/src/util.ts index c96fd7b52..56b1d6e17 100644 --- a/src/util.ts +++ b/src/util.ts @@ -42,13 +42,6 @@ export const DEFAULT_DEBUG_ARTIFACT_NAME = "debug-artifacts"; */ export const DEFAULT_DEBUG_DATABASE_NAME = "db"; -/** - * Environment variable that is set to "true" when the CodeQL Action has invoked - * the Go autobuilder. - */ -export const DID_AUTOBUILD_GO_ENV_VAR_NAME = - "CODEQL_ACTION_DID_AUTOBUILD_GOLANG"; - export interface SarifFile { version?: string | null; runs: SarifRun[];