mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Add RUNNER_ENVIRONMENT to ActionsEnvVars
This commit is contained in:
4
lib/entry-points.js
generated
4
lib/entry-points.js
generated
@@ -145330,7 +145330,7 @@ var getFileType = async (filePath) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
function isSelfHostedRunner(env = getEnv()) {
|
function isSelfHostedRunner(env = getEnv()) {
|
||||||
return env.getOptional("RUNNER_ENVIRONMENT") === "self-hosted";
|
return env.getOptional("RUNNER_ENVIRONMENT" /* RUNNER_ENVIRONMENT */) === "self-hosted";
|
||||||
}
|
}
|
||||||
function isDynamicWorkflow(env = getEnv()) {
|
function isDynamicWorkflow(env = getEnv()) {
|
||||||
return getWorkflowEventName(env) === "dynamic";
|
return getWorkflowEventName(env) === "dynamic";
|
||||||
@@ -151679,7 +151679,7 @@ async function setupCppAutobuild(codeql, logger) {
|
|||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
if (await features.getValue("cpp_dependency_installation_enabled" /* CppDependencyInstallation */, codeql)) {
|
if (await features.getValue("cpp_dependency_installation_enabled" /* CppDependencyInstallation */, codeql)) {
|
||||||
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" && process.env[envVar] !== "true") {
|
if (process.env["RUNNER_ENVIRONMENT" /* RUNNER_ENVIRONMENT */] === "self-hosted" && process.env[envVar] !== "true") {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Disabling ${featureName} as we are on a self-hosted runner.${getWorkflowEventName() !== "dynamic" ? ` To override this, set the ${envVar} environment variable to 'true' in your workflow. See ${"https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow" /* DEFINE_ENV_VARIABLES */} for more information.` : ""}`
|
`Disabling ${featureName} as we are on a self-hosted runner.${getWorkflowEventName() !== "dynamic" ? ` To override this, set the ${envVar} environment variable to 'true' in your workflow. See ${"https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow" /* DEFINE_ENV_VARIABLES */} for more information.` : ""}`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ export const getFileType = async (filePath: string): Promise<string> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function isSelfHostedRunner(env: Env = getEnv()) {
|
export function isSelfHostedRunner(env: Env = getEnv()) {
|
||||||
return env.getOptional("RUNNER_ENVIRONMENT") === "self-hosted";
|
return env.getOptional(ActionsEnvVars.RUNNER_ENVIRONMENT) === "self-hosted";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines whether the workflow trigger is `dynamic`. */
|
/** Determines whether the workflow trigger is `dynamic`. */
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { getGitHubVersion } from "./api-client";
|
|||||||
import { CodeQL, getCodeQL } from "./codeql";
|
import { CodeQL, getCodeQL } from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { DocUrl } from "./doc-url";
|
import { DocUrl } from "./doc-url";
|
||||||
import { EnvVar } from "./environment";
|
import { ActionsEnvVars, EnvVar } from "./environment";
|
||||||
import { Feature, featureConfig, initFeatures } from "./feature-flags";
|
import { Feature, featureConfig, initFeatures } from "./feature-flags";
|
||||||
import { BuiltInLanguage, Language } from "./languages";
|
import { BuiltInLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
@@ -126,7 +126,7 @@ export async function setupCppAutobuild(codeql: CodeQL, logger: Logger) {
|
|||||||
if (await features.getValue(Feature.CppDependencyInstallation, codeql)) {
|
if (await features.getValue(Feature.CppDependencyInstallation, codeql)) {
|
||||||
// disable autoinstall on self-hosted runners unless explicitly requested
|
// disable autoinstall on self-hosted runners unless explicitly requested
|
||||||
if (
|
if (
|
||||||
process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
|
process.env[ActionsEnvVars.RUNNER_ENVIRONMENT] === "self-hosted" &&
|
||||||
process.env[envVar] !== "true"
|
process.env[envVar] !== "true"
|
||||||
) {
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ export enum ActionsEnvVars {
|
|||||||
GITHUB_SERVER_URL = "GITHUB_SERVER_URL",
|
GITHUB_SERVER_URL = "GITHUB_SERVER_URL",
|
||||||
GITHUB_SHA = "GITHUB_SHA",
|
GITHUB_SHA = "GITHUB_SHA",
|
||||||
GITHUB_WORKFLOW = "GITHUB_WORKFLOW",
|
GITHUB_WORKFLOW = "GITHUB_WORKFLOW",
|
||||||
|
RUNNER_ENVIRONMENT = "RUNNER_ENVIRONMENT",
|
||||||
RUNNER_NAME = "RUNNER_NAME",
|
RUNNER_NAME = "RUNNER_NAME",
|
||||||
RUNNER_OS = "RUNNER_OS",
|
RUNNER_OS = "RUNNER_OS",
|
||||||
RUNNER_TEMP = "RUNNER_TEMP",
|
RUNNER_TEMP = "RUNNER_TEMP",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { createStubCodeQL } from "./codeql";
|
import { createStubCodeQL } from "./codeql";
|
||||||
|
import { ActionsEnvVars } from "./environment";
|
||||||
import { Feature } from "./feature-flags";
|
import { Feature } from "./feature-flags";
|
||||||
import {
|
import {
|
||||||
checkPacksForOverlayCompatibility,
|
checkPacksForOverlayCompatibility,
|
||||||
@@ -84,7 +85,7 @@ for (const { runnerEnv, ErrorConstructor, message } of [
|
|||||||
`cleanupDatabaseClusterDirectory throws a ${ErrorConstructor.name} when cleanup fails on ${runnerEnv} runner`,
|
`cleanupDatabaseClusterDirectory throws a ${ErrorConstructor.name} when cleanup fails on ${runnerEnv} runner`,
|
||||||
async (t) => {
|
async (t) => {
|
||||||
await withTmpDir(async (tmpDir: string) => {
|
await withTmpDir(async (tmpDir: string) => {
|
||||||
process.env["RUNNER_ENVIRONMENT"] = runnerEnv;
|
process.env[ActionsEnvVars.RUNNER_ENVIRONMENT] = runnerEnv;
|
||||||
|
|
||||||
const dbLocation = path.resolve(tmpDir, "dbs");
|
const dbLocation = path.resolve(tmpDir, "dbs");
|
||||||
fs.mkdirSync(dbLocation, { recursive: true });
|
fs.mkdirSync(dbLocation, { recursive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user