Merge branch 'main' into dependabot/npm_and_yarn/npm-minor-10933408d3

This commit is contained in:
Michael B. Gale
2026-07-09 16:17:22 +01:00
committed by GitHub
15 changed files with 319 additions and 220 deletions

167
lib/entry-points.js generated
View File

@@ -141462,6 +141462,61 @@ var toolrunner = __toESM(require_toolrunner());
var github = __toESM(require_github());
var io2 = __toESM(require_io());
// src/environment.ts
function getRequiredEnvVar(env, paramName) {
const value = env[paramName];
if (value === void 0 || value.length === 0) {
throw new Error(`${paramName} environment variable must be set`);
}
return value;
}
function getRequiredEnvParam(paramName) {
return getRequiredEnvVar(process.env, paramName);
}
function getOptionalEnvVarFrom(env, paramName) {
const value = env[paramName];
if (value?.trim().length === 0) {
return void 0;
}
return value;
}
function getOptionalEnvVar(paramName) {
return getOptionalEnvVarFrom(process.env, paramName);
}
var ReadOnlyEnv = class {
constructor(vars) {
this.vars = vars;
}
vars;
/** Tries to get the value for `name` and throws if there isn't one. */
getRequired(name) {
return getRequiredEnvVar(this.vars, name);
}
/** Gets the value for `name`, or `undefined` if it isn't set or empty. */
getOptional(name) {
return getOptionalEnvVarFrom(this.vars, name);
}
/** Gets the entries of the underlying `ProcessEnv`. */
entries() {
return Object.entries(this.vars);
}
};
var Env = class extends ReadOnlyEnv {
changed = false;
/** Sets an environment variable. */
set(name, value) {
this.vars[name] = value;
this.changed = true;
}
/** Gets a value indicating whether `set` was called at least once. */
hasChanged() {
return this.changed;
}
};
function getEnv(env = process.env) {
return new Env(env);
}
// src/util.ts
var fs = __toESM(require("fs"));
var fsPromises = __toESM(require("fs/promises"));
@@ -144432,7 +144487,7 @@ var semver = __toESM(require_semver2());
// src/api-compatibility.json
var maximumVersion = "3.22";
var minimumVersion = "3.16";
var minimumVersion = "3.17";
// src/json/index.ts
function parseString(data) {
@@ -144775,32 +144830,6 @@ function initializeEnvironment(version) {
core2.exportVariable("CODEQL_ACTION_FEATURE_WILL_UPLOAD" /* FEATURE_WILL_UPLOAD */, "true");
core2.exportVariable("CODEQL_ACTION_VERSION" /* VERSION */, version);
}
function getEnv(env = process.env) {
return {
getRequired: (name) => getRequiredEnvVar(env, name),
getOptional: (name) => getOptionalEnvVarFrom(env, name)
};
}
function getRequiredEnvVar(env, paramName) {
const value = env[paramName];
if (value === void 0 || value.length === 0) {
throw new Error(`${paramName} environment variable must be set`);
}
return value;
}
function getRequiredEnvParam(paramName) {
return getRequiredEnvVar(process.env, paramName);
}
function getOptionalEnvVarFrom(env, paramName) {
const value = env[paramName];
if (value?.trim().length === 0) {
return void 0;
}
return value;
}
function getOptionalEnvVar(paramName) {
return getOptionalEnvVarFrom(process.env, paramName);
}
var HTTPError = class extends Error {
status;
constructor(message, status) {
@@ -145150,31 +145179,30 @@ var getOptionalInput = function(name) {
const value = core3.getInput(name);
return value.length > 0 ? value : void 0;
};
function getTemporaryDirectory() {
const value = process.env["CODEQL_ACTION_TEMP"];
return value !== void 0 && value !== "" ? value : getRequiredEnvParam("RUNNER_TEMP" /* RUNNER_TEMP */);
function getTemporaryDirectory(env = getEnv()) {
return env.getOptional("CODEQL_ACTION_TEMP" /* TEMP */) ?? env.getRequired("RUNNER_TEMP" /* RUNNER_TEMP */);
}
var PR_DIFF_RANGE_JSON_FILENAME = "pr-diff-range.json";
function getDiffRangesJsonFilePath() {
return path2.join(getTemporaryDirectory(), PR_DIFF_RANGE_JSON_FILENAME);
function getDiffRangesJsonFilePath(env = getEnv()) {
return path2.join(getTemporaryDirectory(env), PR_DIFF_RANGE_JSON_FILENAME);
}
function getActionVersion() {
return "4.37.1";
}
function getWorkflowEventName() {
return getRequiredEnvParam("GITHUB_EVENT_NAME" /* GITHUB_EVENT_NAME */);
function getWorkflowEventName(env = getEnv()) {
return env.getRequired("GITHUB_EVENT_NAME" /* GITHUB_EVENT_NAME */);
}
function isRunningLocalAction() {
const relativeScriptPath = getRelativeScriptPath();
function isRunningLocalAction(env = getEnv()) {
const relativeScriptPath = getRelativeScriptPath(env);
return relativeScriptPath.startsWith("..") || path2.isAbsolute(relativeScriptPath);
}
function getRelativeScriptPath() {
const runnerTemp = getRequiredEnvParam("RUNNER_TEMP" /* RUNNER_TEMP */);
function getRelativeScriptPath(env) {
const runnerTemp = env.getRequired("RUNNER_TEMP" /* RUNNER_TEMP */);
const actionsDirectory = path2.join(path2.dirname(runnerTemp), "_actions");
return path2.relative(actionsDirectory, __filename);
}
function getWorkflowEvent() {
const eventJsonFile = getRequiredEnvParam("GITHUB_EVENT_PATH" /* GITHUB_EVENT_PATH */);
function getWorkflowEvent(env = getEnv()) {
const eventJsonFile = env.getRequired("GITHUB_EVENT_PATH" /* GITHUB_EVENT_PATH */);
try {
return JSON.parse(fs2.readFileSync(eventJsonFile, "utf-8"));
} catch (e) {
@@ -145230,8 +145258,8 @@ function getUploadValue(input) {
return "always";
}
}
function getWorkflowRunID() {
const workflowRunIdString = getRequiredEnvParam("GITHUB_RUN_ID" /* GITHUB_RUN_ID */);
function getWorkflowRunID(env = getEnv()) {
const workflowRunIdString = env.getRequired("GITHUB_RUN_ID" /* GITHUB_RUN_ID */);
const workflowRunID = parseInt(workflowRunIdString, 10);
if (Number.isNaN(workflowRunID)) {
throw new Error(
@@ -145245,8 +145273,8 @@ function getWorkflowRunID() {
}
return workflowRunID;
}
function getWorkflowRunAttempt() {
const workflowRunAttemptString = getRequiredEnvParam(
function getWorkflowRunAttempt(env = getEnv()) {
const workflowRunAttemptString = env.getRequired(
"GITHUB_RUN_ATTEMPT" /* GITHUB_RUN_ATTEMPT */
);
const workflowRunAttempt = parseInt(workflowRunAttemptString, 10);
@@ -145299,14 +145327,14 @@ var getFileType = async (filePath) => {
throw e;
}
};
function isSelfHostedRunner() {
return process.env.RUNNER_ENVIRONMENT === "self-hosted";
function isSelfHostedRunner(env = getEnv()) {
return env.getOptional("RUNNER_ENVIRONMENT" /* RUNNER_ENVIRONMENT */) === "self-hosted";
}
function isDynamicWorkflow() {
return getWorkflowEventName() === "dynamic";
function isDynamicWorkflow(env = getEnv()) {
return getWorkflowEventName(env) === "dynamic";
}
function isDefaultSetup() {
return isDynamicWorkflow();
function isDefaultSetup(env = getEnv()) {
return isDynamicWorkflow(env);
}
function prettyPrintInvocation(cmd, args) {
return [cmd, ...args].map((x) => x.includes(" ") ? `'${x}'` : x).join(" ");
@@ -145370,8 +145398,9 @@ async function runTool(cmd, args = [], opts = {}) {
return stdout;
}
var persistedInputsKey = "persisted_inputs";
var persistInputs = function() {
const inputEnvironmentVariables = Object.entries(process.env).filter(
var persistInputs = function(env = getEnv()) {
const entries = env.entries();
const inputEnvironmentVariables = entries.filter(
([name]) => name.startsWith("INPUT_")
);
core3.saveState(persistedInputsKey, JSON.stringify(inputEnvironmentVariables));
@@ -145384,7 +145413,7 @@ var restoreInputs = function() {
}
}
};
function getPullRequestBranches() {
function getPullRequestBranches(env = getEnv()) {
const pullRequest = github.context.payload.pull_request;
if (pullRequest) {
return {
@@ -145395,8 +145424,10 @@ function getPullRequestBranches() {
head: pullRequest.head.label
};
}
const codeScanningRef = process.env.CODE_SCANNING_REF;
const codeScanningBaseBranch = process.env.CODE_SCANNING_BASE_BRANCH;
const codeScanningRef = env.getOptional("CODE_SCANNING_REF" /* CODE_SCANNING_REF */);
const codeScanningBaseBranch = env.getOptional(
"CODE_SCANNING_BASE_BRANCH" /* CODE_SCANNING_BASE_BRANCH */
);
if (codeScanningRef && codeScanningBaseBranch) {
return {
base: codeScanningBaseBranch,
@@ -145407,8 +145438,8 @@ function getPullRequestBranches() {
}
return void 0;
}
function isAnalyzingPullRequest() {
return getPullRequestBranches() !== void 0;
function isAnalyzingPullRequest(env = getEnv()) {
return getPullRequestBranches(env) !== void 0;
}
var qualityCategoryMapping = {
"c#": "csharp",
@@ -145420,8 +145451,8 @@ var qualityCategoryMapping = {
typescript: "javascript-typescript",
kotlin: "java-kotlin"
};
function fixCodeQualityCategory(logger, category) {
if (category !== void 0 && isDefaultSetup() && category.startsWith("/language:")) {
function fixCodeQualityCategory(logger, category, env = getEnv()) {
if (category !== void 0 && isDefaultSetup(env) && category.startsWith("/language:")) {
const language = category.substring("/language:".length);
const mappedLanguage = qualityCategoryMapping[language];
if (mappedLanguage) {
@@ -145605,15 +145636,15 @@ function createApiClientWithDetails(apiDetails, { allowExternal = false } = {})
})
);
}
function getApiDetails() {
function getApiDetails(env = getEnv()) {
return {
auth: getRequiredInput("token"),
url: getRequiredEnvParam("GITHUB_SERVER_URL" /* GITHUB_SERVER_URL */),
apiURL: getRequiredEnvParam("GITHUB_API_URL" /* GITHUB_API_URL */)
url: env.getRequired("GITHUB_SERVER_URL" /* GITHUB_SERVER_URL */),
apiURL: env.getRequired("GITHUB_API_URL" /* GITHUB_API_URL */)
};
}
function getApiClient() {
return createApiClientWithDetails(getApiDetails());
function getApiClient(env = getEnv()) {
return createApiClientWithDetails(getApiDetails(env));
}
function getApiClientWithExternalAuth(apiDetails) {
return createApiClientWithDetails(apiDetails, { allowExternal: true });
@@ -151013,9 +151044,9 @@ async function getCombinedTracerConfig(codeql, config) {
// src/codeql.ts
var cachedCodeQL = void 0;
var CODEQL_MINIMUM_VERSION = "2.19.4";
var CODEQL_NEXT_MINIMUM_VERSION = "2.19.4";
var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.15";
var GHES_MOST_RECENT_DEPRECATION_DATE = "2026-04-09";
var CODEQL_NEXT_MINIMUM_VERSION = "2.20.7";
var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.16";
var GHES_MOST_RECENT_DEPRECATION_DATE = "2026-07-01";
var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, rawLanguages, useOverlayAwareDefaultCliVersion, features, logger, checkVersion) {
try {
@@ -151648,7 +151679,7 @@ async function setupCppAutobuild(codeql, logger) {
logger
);
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(
`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.` : ""}`
);