Replace getRequiredEnvParam calls in init and setup-codeql action

This commit is contained in:
Michael B. Gale
2026-09-16 12:29:46 +01:00
parent a7afe0a2d7
commit 669351e880
3 changed files with 18 additions and 16 deletions

14
lib/entry-points.js generated
View File

@@ -162239,8 +162239,8 @@ async function run3(actionState) {
apiDetails = { apiDetails = {
auth: getRequiredInput("token"), auth: getRequiredInput("token"),
externalRepoAuth: getOptionalInput("external-repository-token"), externalRepoAuth: getOptionalInput("external-repository-token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"), url: actionState.env.getRequired("GITHUB_SERVER_URL" /* GITHUB_SERVER_URL */),
apiURL: getRequiredEnvParam("GITHUB_API_URL") apiURL: actionState.env.getRequired("GITHUB_API_URL" /* GITHUB_API_URL */)
}; };
const gitHubVersion = await getGitHubVersion(); const gitHubVersion = await getGitHubVersion();
checkGitHubVersionInRange(gitHubVersion, logger); checkGitHubVersionInRange(gitHubVersion, logger);
@@ -162259,7 +162259,7 @@ async function run3(actionState) {
const repositoryProperties = repositoryPropertiesResult.orElse({}); const repositoryProperties = repositoryPropertiesResult.orElse({});
core22.exportVariable("CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */, "true"); core22.exportVariable("CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */, "true");
sourceRoot = path25.resolve( sourceRoot = path25.resolve(
getRequiredEnvParam("GITHUB_WORKSPACE"), actionState.env.getRequired("GITHUB_WORKSPACE" /* GITHUB_WORKSPACE */),
getOptionalInput("source-root") || "" getOptionalInput("source-root") || ""
); );
let analysisKinds; let analysisKinds;
@@ -162355,7 +162355,9 @@ async function run3(actionState) {
repository: repositoryNwo, repository: repositoryNwo,
tempDir: getTemporaryDirectory(), tempDir: getTemporaryDirectory(),
codeql, codeql,
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"), workspacePath: actionState.env.getRequired(
"GITHUB_WORKSPACE" /* GITHUB_WORKSPACE */
),
sourceRoot, sourceRoot,
githubVersion: gitHubVersion, githubVersion: gitHubVersion,
apiDetails, apiDetails,
@@ -163254,8 +163256,8 @@ async function run6(actionState) {
const apiDetails = { const apiDetails = {
auth: getRequiredInput("token"), auth: getRequiredInput("token"),
externalRepoAuth: getOptionalInput("external-repository-token"), externalRepoAuth: getOptionalInput("external-repository-token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"), url: actionState.env.getRequired("GITHUB_SERVER_URL" /* GITHUB_SERVER_URL */),
apiURL: getRequiredEnvParam("GITHUB_API_URL") apiURL: actionState.env.getRequired("GITHUB_API_URL" /* GITHUB_API_URL */)
}; };
const gitHubVersion = await getGitHubVersion(); const gitHubVersion = await getGitHubVersion();
checkGitHubVersionInRange(gitHubVersion, logger); checkGitHubVersionInRange(gitHubVersion, logger);

View File

@@ -38,7 +38,7 @@ import {
makeDiagnostic, makeDiagnostic,
makeTelemetryDiagnostic, makeTelemetryDiagnostic,
} from "./diagnostics"; } from "./diagnostics";
import { EnvVar } from "./environment"; import { ActionsEnvVars, EnvVar } from "./environment";
import { Feature, FeatureEnablement, initFeatures } from "./feature-flags"; import { Feature, FeatureEnablement, initFeatures } from "./feature-flags";
import { loadRepositoryProperties } from "./feature-flags/properties"; import { loadRepositoryProperties } from "./feature-flags/properties";
import { import {
@@ -81,7 +81,6 @@ import {
DEFAULT_DEBUG_ARTIFACT_NAME, DEFAULT_DEBUG_ARTIFACT_NAME,
DEFAULT_DEBUG_DATABASE_NAME, DEFAULT_DEBUG_DATABASE_NAME,
getCodeQLMemoryLimit, getCodeQLMemoryLimit,
getRequiredEnvParam,
getThreadsFlagValue, getThreadsFlagValue,
initializeEnvironment, initializeEnvironment,
ConfigurationError, ConfigurationError,
@@ -225,8 +224,8 @@ async function run(
apiDetails = { apiDetails = {
auth: getRequiredInput("token"), auth: getRequiredInput("token"),
externalRepoAuth: getOptionalInput("external-repository-token"), externalRepoAuth: getOptionalInput("external-repository-token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"), url: actionState.env.getRequired(ActionsEnvVars.GITHUB_SERVER_URL),
apiURL: getRequiredEnvParam("GITHUB_API_URL"), apiURL: actionState.env.getRequired(ActionsEnvVars.GITHUB_API_URL),
}; };
const gitHubVersion = await getGitHubVersion(); const gitHubVersion = await getGitHubVersion();
@@ -255,7 +254,7 @@ async function run(
// source-root is relative, it is relative to the GITHUB_WORKSPACE. If // source-root is relative, it is relative to the GITHUB_WORKSPACE. If
// source-root is absolute, it is used as given. // source-root is absolute, it is used as given.
sourceRoot = path.resolve( sourceRoot = path.resolve(
getRequiredEnvParam("GITHUB_WORKSPACE"), actionState.env.getRequired(ActionsEnvVars.GITHUB_WORKSPACE),
getOptionalInput("source-root") || "", getOptionalInput("source-root") || "",
); );
@@ -383,7 +382,9 @@ async function run(
repository: repositoryNwo, repository: repositoryNwo,
tempDir: getTemporaryDirectory(), tempDir: getTemporaryDirectory(),
codeql, codeql,
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"), workspacePath: actionState.env.getRequired(
ActionsEnvVars.GITHUB_WORKSPACE,
),
sourceRoot, sourceRoot,
githubVersion: gitHubVersion, githubVersion: gitHubVersion,
apiDetails, apiDetails,

View File

@@ -12,7 +12,7 @@ import { getGitHubVersion } from "./api-client";
import { CodeQL } from "./codeql"; import { CodeQL } from "./codeql";
import { ComputedInput, getToolsInput } from "./config/inputs"; import { ComputedInput, getToolsInput } from "./config/inputs";
import { getRawLanguagesNoAutodetect } from "./config-utils"; import { getRawLanguagesNoAutodetect } from "./config-utils";
import { EnvVar } from "./environment"; import { ActionsEnvVars, EnvVar } from "./environment";
import { initFeatures } from "./feature-flags"; import { initFeatures } from "./feature-flags";
import { loadRepositoryProperties } from "./feature-flags/properties"; import { loadRepositoryProperties } from "./feature-flags/properties";
import { initCodeQL } from "./init"; import { initCodeQL } from "./init";
@@ -32,7 +32,6 @@ import {
checkDiskUsage, checkDiskUsage,
checkForTimeout, checkForTimeout,
checkGitHubVersionInRange, checkGitHubVersionInRange,
getRequiredEnvParam,
initializeEnvironment, initializeEnvironment,
ConfigurationError, ConfigurationError,
wrapError, wrapError,
@@ -108,8 +107,8 @@ async function run(
const apiDetails = { const apiDetails = {
auth: getRequiredInput("token"), auth: getRequiredInput("token"),
externalRepoAuth: getOptionalInput("external-repository-token"), externalRepoAuth: getOptionalInput("external-repository-token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL"), url: actionState.env.getRequired(ActionsEnvVars.GITHUB_SERVER_URL),
apiURL: getRequiredEnvParam("GITHUB_API_URL"), apiURL: actionState.env.getRequired(ActionsEnvVars.GITHUB_API_URL),
}; };
const gitHubVersion = await getGitHubVersion(); const gitHubVersion = await getGitHubVersion();