Skip to content

Commit 80dcb7c

Browse files
committed
Add RUNNER_ENVIRONMENT to ActionsEnvVars
1 parent a440e35 commit 80dcb7c

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

lib/entry-points.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions-util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export const getFileType = async (filePath: string): Promise<string> => {
275275
};
276276

277277
export function isSelfHostedRunner(env: Env = getEnv()) {
278-
return env.getOptional("RUNNER_ENVIRONMENT") === "self-hosted";
278+
return env.getOptional(ActionsEnvVars.RUNNER_ENVIRONMENT) === "self-hosted";
279279
}
280280

281281
/** Determines whether the workflow trigger is `dynamic`. */

src/autobuild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getGitHubVersion } from "./api-client";
55
import { CodeQL, getCodeQL } from "./codeql";
66
import * as configUtils from "./config-utils";
77
import { DocUrl } from "./doc-url";
8-
import { EnvVar } from "./environment";
8+
import { ActionsEnvVars, EnvVar } from "./environment";
99
import { Feature, featureConfig, initFeatures } from "./feature-flags";
1010
import { BuiltInLanguage, Language } from "./languages";
1111
import { Logger } from "./logging";
@@ -126,7 +126,7 @@ export async function setupCppAutobuild(codeql: CodeQL, logger: Logger) {
126126
if (await features.getValue(Feature.CppDependencyInstallation, codeql)) {
127127
// disable autoinstall on self-hosted runners unless explicitly requested
128128
if (
129-
process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
129+
process.env[ActionsEnvVars.RUNNER_ENVIRONMENT] === "self-hosted" &&
130130
process.env[envVar] !== "true"
131131
) {
132132
logger.info(

src/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export enum ActionsEnvVars {
181181
GITHUB_SERVER_URL = "GITHUB_SERVER_URL",
182182
GITHUB_SHA = "GITHUB_SHA",
183183
GITHUB_WORKFLOW = "GITHUB_WORKFLOW",
184+
RUNNER_ENVIRONMENT = "RUNNER_ENVIRONMENT",
184185
RUNNER_NAME = "RUNNER_NAME",
185186
RUNNER_OS = "RUNNER_OS",
186187
RUNNER_TEMP = "RUNNER_TEMP",

src/init.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as sinon from "sinon";
88

99
import * as actionsUtil from "./actions-util";
1010
import { createStubCodeQL } from "./codeql";
11+
import { ActionsEnvVars } from "./environment";
1112
import { Feature } from "./feature-flags";
1213
import {
1314
checkPacksForOverlayCompatibility,
@@ -84,7 +85,7 @@ for (const { runnerEnv, ErrorConstructor, message } of [
8485
`cleanupDatabaseClusterDirectory throws a ${ErrorConstructor.name} when cleanup fails on ${runnerEnv} runner`,
8586
async (t) => {
8687
await withTmpDir(async (tmpDir: string) => {
87-
process.env["RUNNER_ENVIRONMENT"] = runnerEnv;
88+
process.env[ActionsEnvVars.RUNNER_ENVIRONMENT] = runnerEnv;
8889

8990
const dbLocation = path.resolve(tmpDir, "dbs");
9091
fs.mkdirSync(dbLocation, { recursive: true });

0 commit comments

Comments
 (0)