From c5913260b1c079c5b1b6262db0bcef624f742757 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:27:30 +0100 Subject: [PATCH 01/10] Re-export `ActionName` from `action-common.ts` --- src/action-common.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/action-common.ts b/src/action-common.ts index 79f1901f22..360cb2bbbf 100644 --- a/src/action-common.ts +++ b/src/action-common.ts @@ -13,6 +13,8 @@ import { } from "./status-report"; import { getEnv, getErrorMessage, wrapError } from "./util"; +export { ActionName } from "./status-report"; + /** Base state that is available to an Action on startup. */ export interface BaseState { /** The name of the Action. */ From a4c1eb2b5fe3a44d86ebde89c514f8c1475e0d36 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:29:53 +0100 Subject: [PATCH 02/10] Add remaining post-actions to `ActionName` --- lib/entry-points.js | 5 ++++- src/status-report.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 1a99a44427..2ce94a6783 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -171424,7 +171424,10 @@ function getAddressString(address) { // src/status-report.ts var ACTION_DISPLAY_NAMES = { ["finish" /* Analyze */]: "analyze", - ["init-post" /* InitPost */]: "init post" + ["analyze-post" /* AnalyzePost */]: "analyze post-action", + ["init-post" /* InitPost */]: "init post", + ["start-proxy-post" /* StartProxyPost */]: "start-proxy post-action", + ["upload-sarif-post" /* UploadSarifPost */]: "upload-sarif post-action" }; function getDisplayActionName(actionName) { const displayName = ACTION_DISPLAY_NAMES[actionName]; diff --git a/src/status-report.ts b/src/status-report.ts index 9420aa2a10..15cd6dd98c 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -52,19 +52,25 @@ import { export enum ActionName { Analyze = "finish", + AnalyzePost = "analyze-post", Autobuild = "autobuild", Init = "init", InitPost = "init-post", ResolveEnvironment = "resolve-environment", SetupCodeQL = "setup-codeql", StartProxy = "start-proxy", + StartProxyPost = "start-proxy-post", UploadSarif = "upload-sarif", + UploadSarifPost = "upload-sarif-post", } /** A partial mapping from `ActionName` to names for actions whose display name is not the `ActionName` value. */ export const ACTION_DISPLAY_NAMES: Partial> = { [ActionName.Analyze]: "analyze", + [ActionName.AnalyzePost]: "analyze post-action", [ActionName.InitPost]: "init post", + [ActionName.StartProxyPost]: "start-proxy post-action", + [ActionName.UploadSarifPost]: "upload-sarif post-action", }; /** From 1907698e1966b3dbf00ccc45fc0093ca61ac1b43 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:33:52 +0100 Subject: [PATCH 03/10] Use `runInActions` for the `start-proxy` post-action --- lib/entry-points.js | 100 ++++++++++++++++++--------------- src/start-proxy-action-post.ts | 28 ++++++++- 2 files changed, 79 insertions(+), 49 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 2ce94a6783..7e6d3701f8 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -28816,7 +28816,7 @@ var require_light = __commonJS({ } return this.Events.trigger("scheduled", { args: this.args, options: this.options }); } - async doExecute(chained, clearGlobalState, run9, free) { + async doExecute(chained, clearGlobalState, run10, free) { var error3, eventInfo, passed; if (this.retryCount === 0) { this._assertStatus("RUNNING"); @@ -28836,10 +28836,10 @@ var require_light = __commonJS({ } } catch (error1) { error3 = error1; - return this._onFailure(error3, eventInfo, clearGlobalState, run9, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run10, free); } } - doExpire(clearGlobalState, run9, free) { + doExpire(clearGlobalState, run10, free) { var error3, eventInfo; if (this._states.jobStatus(this.options.id === "RUNNING")) { this._states.next(this.options.id); @@ -28847,9 +28847,9 @@ var require_light = __commonJS({ this._assertStatus("EXECUTING"); eventInfo = { args: this.args, options: this.options, retryCount: this.retryCount }; error3 = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`); - return this._onFailure(error3, eventInfo, clearGlobalState, run9, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run10, free); } - async _onFailure(error3, eventInfo, clearGlobalState, run9, free) { + async _onFailure(error3, eventInfo, clearGlobalState, run10, free) { var retry2, retryAfter; if (clearGlobalState()) { retry2 = await this.Events.trigger("failed", error3, eventInfo); @@ -28857,7 +28857,7 @@ var require_light = __commonJS({ retryAfter = ~~retry2; this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo); this.retryCount++; - return run9(retryAfter); + return run10(retryAfter); } else { this.doDone(eventInfo); await free(this.options, eventInfo); @@ -29495,17 +29495,17 @@ var require_light = __commonJS({ } } _run(index2, job, wait) { - var clearGlobalState, free, run9; + var clearGlobalState, free, run10; job.doRun(); clearGlobalState = this._clearGlobalState.bind(this, index2); - run9 = this._run.bind(this, index2, job); + run10 = this._run.bind(this, index2, job); free = this._free.bind(this, index2, job); return this._scheduled[index2] = { timeout: setTimeout(() => { - return job.doExecute(this._limiter, clearGlobalState, run9, free); + return job.doExecute(this._limiter, clearGlobalState, run10, free); }, wait), expiration: job.options.expiration != null ? setTimeout(function() { - return job.doExpire(clearGlobalState, run9, free); + return job.doExpire(clearGlobalState, run10, free); }, wait + job.options.expiration) : void 0, job }; @@ -51046,14 +51046,14 @@ var require_crc64 = __commonJS({ missingLibrarySymbols.forEach(missingLibrarySymbol); var calledRun; dependenciesFulfilled = function runCaller() { - if (!calledRun) run9(); + if (!calledRun) run10(); if (!calledRun) dependenciesFulfilled = runCaller; }; function stackCheckInit() { _emscripten_stack_init(); writeStackCookie(); } - function run9(args) { + function run10(args) { args = args || arguments_; if (runDependencies > 0) { return; @@ -51111,7 +51111,7 @@ var require_crc64 = __commonJS({ Module["preInit"].pop()(); } } - run9(); + run10(); function WrapperObject() { } WrapperObject.prototype = Object.create(WrapperObject.prototype); @@ -114994,8 +114994,8 @@ var require_async = __commonJS({ return callback(null, results); } while (readyTasks.length && runningTasks < concurrency) { - var run9 = readyTasks.shift(); - run9(); + var run10 = readyTasks.shift(); + run10(); } } function addListener(taskName, fn) { @@ -179643,9 +179643,9 @@ async function addFingerprints(sarifLog, sourceRoot, logger2) { `Adding fingerprints to SARIF file. See ${"https://docs.github.com/en/code-security/reference/code-scanning/sarif-support-for-code-scanning#data-for-preventing-duplicated-alerts" /* TRACK_CODE_SCANNING_ALERTS_ACROSS_RUNS */} for more information.` ); const callbacksByFile = {}; - for (const run9 of sarifLog.runs || []) { - const artifacts = run9.artifacts || []; - for (const result of run9.results || []) { + for (const run10 of sarifLog.runs || []) { + const artifacts = run10.artifacts || []; + for (const result of run10.results || []) { const primaryLocation = (result.locations || [])[0]; if (!primaryLocation?.physicalLocation?.artifactLocation) { logger2.debug( @@ -179920,8 +179920,8 @@ var InvalidSarifUploadError = class extends Error { }; function getToolNames(sarifFile) { const toolNames = {}; - for (const run9 of sarifFile.runs || []) { - const tool = run9.tool || {}; + for (const run10 of sarifFile.runs || []) { + const tool = run10.tool || {}; const driver = tool.driver || {}; if (typeof driver.name === "string" && driver.name.length > 0) { toolNames[driver.name] = true; @@ -179961,17 +179961,17 @@ function combineSarifFiles(sarifFiles, logger2) { } function areAllRunsProducedByCodeQL(sarifLogs) { return sarifLogs.every((sarifLog) => { - return sarifLog.runs?.every((run9) => run9.tool?.driver?.name === "CodeQL"); + return sarifLog.runs?.every((run10) => run10.tool?.driver?.name === "CodeQL"); }); } -function createRunKey(run9) { +function createRunKey(run10) { return { - name: run9.tool?.driver?.name, - fullName: run9.tool?.driver?.fullName, - version: run9.tool?.driver?.version, - semanticVersion: run9.tool?.driver?.semanticVersion, - guid: run9.tool?.driver?.guid, - automationId: run9.automationDetails?.id + name: run10.tool?.driver?.name, + fullName: run10.tool?.driver?.fullName, + version: run10.tool?.driver?.version, + semanticVersion: run10.tool?.driver?.semanticVersion, + guid: run10.tool?.driver?.guid, + automationId: run10.automationDetails?.id }; } function areAllRunsUnique(sarifLogs) { @@ -179980,8 +179980,8 @@ function areAllRunsUnique(sarifLogs) { if (sarifLog.runs === void 0) { continue; } - for (const run9 of sarifLog.runs) { - const key = JSON.stringify(createRunKey(run9)); + for (const run10 of sarifLog.runs) { + const key = JSON.stringify(createRunKey(run10)); if (keys.has(key)) { return false; } @@ -180084,9 +180084,9 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo function populateRunAutomationDetails(sarifFile, category, analysis_key, environment) { const automationID = getAutomationID2(category, analysis_key, environment); if (automationID !== void 0) { - for (const run9 of sarifFile.runs || []) { - if (run9.automationDetails === void 0) { - run9.automationDetails = { + for (const run10 of sarifFile.runs || []) { + if (run10.automationDetails === void 0) { + run10.automationDetails = { id: automationID }; } @@ -180233,13 +180233,13 @@ function countResultsInSarif(sarifLog) { if (!Array.isArray(parsedSarif.runs)) { throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array."); } - for (const run9 of parsedSarif.runs) { - if (!Array.isArray(run9.results)) { + for (const run10 of parsedSarif.runs) { + if (!Array.isArray(run10.results)) { throw new InvalidSarifUploadError( "Invalid SARIF. Missing 'results' array in run." ); } - numResults += run9.results.length; + numResults += run10.results.length; } return numResults; } @@ -180566,9 +180566,9 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger } function validateUniqueCategory(sarifLog, sentinelPrefix) { const categories = {}; - for (const run9 of sarifLog.runs || []) { - const id = run9?.automationDetails?.id; - const tool = run9.tool?.driver?.name; + for (const run10 of sarifLog.runs || []) { + const id = run10?.automationDetails?.id; + const tool = run10.tool?.driver?.name; const category = `${sanitize(id)}_${sanitize(tool)}`; categories[category] = { id, tool }; } @@ -180593,9 +180593,9 @@ function filterAlertsByDiffRange(logger2, sarifLog) { if (sarifLog.runs === void 0) { return sarifLog; } - for (const run9 of sarifLog.runs) { - if (run9.results) { - run9.results = run9.results.filter((result) => { + for (const run10 of sarifLog.runs) { + if (run10.results) { + run10.results = run10.results.filter((result) => { const locations = [ ...(result.locations || []).map((loc) => loc.physicalLocation), ...(result.relatedLocations || []).map((loc) => loc.physicalLocation) @@ -188394,8 +188394,8 @@ async function startProxy(binPath, config, logFilePath, logger2) { // src/start-proxy-action-post.ts var core26 = __toESM(require_core()); -async function runWrapper9() { - const logger2 = getActionsLogger(); +async function run8(action) { + const logger2 = action.logger; try { restoreInputs(logger2); const pid = core26.getState("proxy-process-pid"); @@ -188427,6 +188427,14 @@ async function runWrapper9() { ); } } +var startProxyPostAction = { + name: "start-proxy-post" /* StartProxyPost */, + run: run8, + transformTelemetryError: getSafeErrorMessage +}; +async function runWrapper9() { + await runInActions(startProxyPostAction); +} // src/upload-sarif-action.ts var core27 = __toESM(require_core()); @@ -188447,7 +188455,7 @@ async function sendSuccessStatusReport2(startedAt, uploadStats, logger2) { await sendStatusReport(statusReport); } } -async function run8({ startedAt, logger: logger2 }) { +async function run9({ startedAt, logger: logger2 }) { try { initializeEnvironment(getActionVersion()); const gitHubVersion = await getGitHubVersion(); @@ -188532,7 +188540,7 @@ async function run8({ startedAt, logger: logger2 }) { } var uploadSarif = { name: "upload-sarif" /* UploadSarif */, - run: run8 + run: run9 }; async function runWrapper10() { await runInActions(uploadSarif); diff --git a/src/start-proxy-action-post.ts b/src/start-proxy-action-post.ts index c872207ac0..0b10afcbec 100644 --- a/src/start-proxy-action-post.ts +++ b/src/start-proxy-action-post.ts @@ -5,18 +5,28 @@ */ import * as core from "@actions/core"; +import { + ActionName, + runInActions, + type Action, + type ActionState, +} from "./action-common"; import * as actionsUtil from "./actions-util"; import { getGitHubVersion } from "./api-client"; import * as configUtils from "./config-utils"; import { uploadArtifacts } from "./debug-artifacts"; -import { getActionsLogger } from "./logging"; +import { getSafeErrorMessage } from "./start-proxy/status-report"; import { checkGitHubVersionInRange, getErrorMessage } from "./util"; -export async function runWrapper() { +/** + * The main functionality of the `start-proxy` post-action is implemented by this function. + * This is called once by {@link runInActions} after it is called in {@link runWrapper}. + */ +export async function run(action: ActionState<["Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. - const logger = getActionsLogger(); + const logger = action.logger; try { // Restore inputs from `start-proxy` Action. @@ -56,3 +66,15 @@ export async function runWrapper() { ); } } + +/** Defines the `start-proxy` post-action. */ +const startProxyPostAction: Action = { + name: ActionName.StartProxyPost, + run, + transformTelemetryError: getSafeErrorMessage, +}; + +/** The main entry point for the `start-proxy` post-action. */ +export async function runWrapper() { + await runInActions(startProxyPostAction); +} From dca467bb23f89c35a15fea4766db9e9c21b5eec3 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:37:28 +0100 Subject: [PATCH 04/10] Use `runInActions` for the `analyze` post-action --- lib/entry-points.js | 127 +++++++++++++++++++------------------ src/analyze-action-post.ts | 26 +++++++- 2 files changed, 90 insertions(+), 63 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 7e6d3701f8..296ef9f4ae 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -28816,7 +28816,7 @@ var require_light = __commonJS({ } return this.Events.trigger("scheduled", { args: this.args, options: this.options }); } - async doExecute(chained, clearGlobalState, run10, free) { + async doExecute(chained, clearGlobalState, run11, free) { var error3, eventInfo, passed; if (this.retryCount === 0) { this._assertStatus("RUNNING"); @@ -28836,10 +28836,10 @@ var require_light = __commonJS({ } } catch (error1) { error3 = error1; - return this._onFailure(error3, eventInfo, clearGlobalState, run10, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run11, free); } } - doExpire(clearGlobalState, run10, free) { + doExpire(clearGlobalState, run11, free) { var error3, eventInfo; if (this._states.jobStatus(this.options.id === "RUNNING")) { this._states.next(this.options.id); @@ -28847,9 +28847,9 @@ var require_light = __commonJS({ this._assertStatus("EXECUTING"); eventInfo = { args: this.args, options: this.options, retryCount: this.retryCount }; error3 = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`); - return this._onFailure(error3, eventInfo, clearGlobalState, run10, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run11, free); } - async _onFailure(error3, eventInfo, clearGlobalState, run10, free) { + async _onFailure(error3, eventInfo, clearGlobalState, run11, free) { var retry2, retryAfter; if (clearGlobalState()) { retry2 = await this.Events.trigger("failed", error3, eventInfo); @@ -28857,7 +28857,7 @@ var require_light = __commonJS({ retryAfter = ~~retry2; this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo); this.retryCount++; - return run10(retryAfter); + return run11(retryAfter); } else { this.doDone(eventInfo); await free(this.options, eventInfo); @@ -29495,17 +29495,17 @@ var require_light = __commonJS({ } } _run(index2, job, wait) { - var clearGlobalState, free, run10; + var clearGlobalState, free, run11; job.doRun(); clearGlobalState = this._clearGlobalState.bind(this, index2); - run10 = this._run.bind(this, index2, job); + run11 = this._run.bind(this, index2, job); free = this._free.bind(this, index2, job); return this._scheduled[index2] = { timeout: setTimeout(() => { - return job.doExecute(this._limiter, clearGlobalState, run10, free); + return job.doExecute(this._limiter, clearGlobalState, run11, free); }, wait), expiration: job.options.expiration != null ? setTimeout(function() { - return job.doExpire(clearGlobalState, run10, free); + return job.doExpire(clearGlobalState, run11, free); }, wait + job.options.expiration) : void 0, job }; @@ -51046,14 +51046,14 @@ var require_crc64 = __commonJS({ missingLibrarySymbols.forEach(missingLibrarySymbol); var calledRun; dependenciesFulfilled = function runCaller() { - if (!calledRun) run10(); + if (!calledRun) run11(); if (!calledRun) dependenciesFulfilled = runCaller; }; function stackCheckInit() { _emscripten_stack_init(); writeStackCookie(); } - function run10(args) { + function run11(args) { args = args || arguments_; if (runDependencies > 0) { return; @@ -51111,7 +51111,7 @@ var require_crc64 = __commonJS({ Module["preInit"].pop()(); } } - run10(); + run11(); function WrapperObject() { } WrapperObject.prototype = Object.create(WrapperObject.prototype); @@ -114994,8 +114994,8 @@ var require_async = __commonJS({ return callback(null, results); } while (readyTasks.length && runningTasks < concurrency) { - var run10 = readyTasks.shift(); - run10(); + var run11 = readyTasks.shift(); + run11(); } } function addListener(taskName, fn) { @@ -179643,9 +179643,9 @@ async function addFingerprints(sarifLog, sourceRoot, logger2) { `Adding fingerprints to SARIF file. See ${"https://docs.github.com/en/code-security/reference/code-scanning/sarif-support-for-code-scanning#data-for-preventing-duplicated-alerts" /* TRACK_CODE_SCANNING_ALERTS_ACROSS_RUNS */} for more information.` ); const callbacksByFile = {}; - for (const run10 of sarifLog.runs || []) { - const artifacts = run10.artifacts || []; - for (const result of run10.results || []) { + for (const run11 of sarifLog.runs || []) { + const artifacts = run11.artifacts || []; + for (const result of run11.results || []) { const primaryLocation = (result.locations || [])[0]; if (!primaryLocation?.physicalLocation?.artifactLocation) { logger2.debug( @@ -179920,8 +179920,8 @@ var InvalidSarifUploadError = class extends Error { }; function getToolNames(sarifFile) { const toolNames = {}; - for (const run10 of sarifFile.runs || []) { - const tool = run10.tool || {}; + for (const run11 of sarifFile.runs || []) { + const tool = run11.tool || {}; const driver = tool.driver || {}; if (typeof driver.name === "string" && driver.name.length > 0) { toolNames[driver.name] = true; @@ -179961,17 +179961,17 @@ function combineSarifFiles(sarifFiles, logger2) { } function areAllRunsProducedByCodeQL(sarifLogs) { return sarifLogs.every((sarifLog) => { - return sarifLog.runs?.every((run10) => run10.tool?.driver?.name === "CodeQL"); + return sarifLog.runs?.every((run11) => run11.tool?.driver?.name === "CodeQL"); }); } -function createRunKey(run10) { +function createRunKey(run11) { return { - name: run10.tool?.driver?.name, - fullName: run10.tool?.driver?.fullName, - version: run10.tool?.driver?.version, - semanticVersion: run10.tool?.driver?.semanticVersion, - guid: run10.tool?.driver?.guid, - automationId: run10.automationDetails?.id + name: run11.tool?.driver?.name, + fullName: run11.tool?.driver?.fullName, + version: run11.tool?.driver?.version, + semanticVersion: run11.tool?.driver?.semanticVersion, + guid: run11.tool?.driver?.guid, + automationId: run11.automationDetails?.id }; } function areAllRunsUnique(sarifLogs) { @@ -179980,8 +179980,8 @@ function areAllRunsUnique(sarifLogs) { if (sarifLog.runs === void 0) { continue; } - for (const run10 of sarifLog.runs) { - const key = JSON.stringify(createRunKey(run10)); + for (const run11 of sarifLog.runs) { + const key = JSON.stringify(createRunKey(run11)); if (keys.has(key)) { return false; } @@ -180084,9 +180084,9 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo function populateRunAutomationDetails(sarifFile, category, analysis_key, environment) { const automationID = getAutomationID2(category, analysis_key, environment); if (automationID !== void 0) { - for (const run10 of sarifFile.runs || []) { - if (run10.automationDetails === void 0) { - run10.automationDetails = { + for (const run11 of sarifFile.runs || []) { + if (run11.automationDetails === void 0) { + run11.automationDetails = { id: automationID }; } @@ -180233,13 +180233,13 @@ function countResultsInSarif(sarifLog) { if (!Array.isArray(parsedSarif.runs)) { throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array."); } - for (const run10 of parsedSarif.runs) { - if (!Array.isArray(run10.results)) { + for (const run11 of parsedSarif.runs) { + if (!Array.isArray(run11.results)) { throw new InvalidSarifUploadError( "Invalid SARIF. Missing 'results' array in run." ); } - numResults += run10.results.length; + numResults += run11.results.length; } return numResults; } @@ -180566,9 +180566,9 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger } function validateUniqueCategory(sarifLog, sentinelPrefix) { const categories = {}; - for (const run10 of sarifLog.runs || []) { - const id = run10?.automationDetails?.id; - const tool = run10.tool?.driver?.name; + for (const run11 of sarifLog.runs || []) { + const id = run11?.automationDetails?.id; + const tool = run11.tool?.driver?.name; const category = `${sanitize(id)}_${sanitize(tool)}`; categories[category] = { id, tool }; } @@ -180593,9 +180593,9 @@ function filterAlertsByDiffRange(logger2, sarifLog) { if (sarifLog.runs === void 0) { return sarifLog; } - for (const run10 of sarifLog.runs) { - if (run10.results) { - run10.results = run10.results.filter((result) => { + for (const run11 of sarifLog.runs) { + if (run11.results) { + run11.results = run11.results.filter((result) => { const locations = [ ...(result.locations || []).map((loc) => loc.physicalLocation), ...(result.relatedLocations || []).map((loc) => loc.physicalLocation) @@ -185899,9 +185899,9 @@ async function createDatabaseBundleCli(codeql, config, language) { } // src/analyze-action-post.ts -async function runWrapper2() { +async function run2(action) { + const logger2 = action.logger; try { - const logger2 = getActionsLogger(); restoreInputs(logger2); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); @@ -185938,6 +185938,13 @@ async function runWrapper2() { ); } } +var analyzePostAction = { + name: "analyze-post" /* AnalyzePost */, + run: run2 +}; +async function runWrapper2() { + await runInActions(analyzePostAction); +} // src/autobuild-action.ts var core17 = __toESM(require_core()); @@ -185963,7 +185970,7 @@ async function sendCompletedStatusReport(config, logger2, startedAt, allLanguage await sendStatusReport(statusReport); } } -async function run2({ +async function run3({ startedAt, env, logger: logger2 @@ -186028,7 +186035,7 @@ async function run2({ } var autobuild = { name: "autobuild" /* Autobuild */, - run: run2 + run: run3 }; async function runWrapper3() { await runInActions(autobuild); @@ -186437,7 +186444,7 @@ async function sendCompletedStatusReport2(startedAt, config, configFile, toolsIn await sendStatusReport({ ...initStatusReport, ...initToolsDownloadFields }); } } -async function run3(actionState) { +async function run4(actionState) { const startedAt = actionState.startedAt; const logger2 = actionState.logger; let apiDetails; @@ -186877,7 +186884,7 @@ exec ${goBinaryPath} "$@"` } var init = { name: "init" /* Init */, - run: run3 + run: run4 }; async function runWrapper4() { await runInActions(init); @@ -187224,7 +187231,7 @@ async function removeUploadedSarif(uploadFailedSarifResult, logger2) { } // src/init-action-post.ts -async function run4(action) { +async function run5(action) { const logger2 = action.logger; let config; let uploadFailedSarifResult; @@ -187339,7 +187346,7 @@ function getJobStatusFromEnvironment(env) { } var initPost = { name: "init-post" /* InitPost */, - run: run4 + run: run5 }; async function runWrapper5() { return await runInActions(initPost); @@ -187362,7 +187369,7 @@ async function runResolveBuildEnvironment(cmd, logger2, workingDir, language) { // src/resolve-environment-action.ts var ENVIRONMENT_OUTPUT_NAME = "environment"; -async function run5(startedAt) { +async function run6(startedAt) { const logger2 = getActionsLogger(); let config; try { @@ -187437,7 +187444,7 @@ async function runWrapper6() { const startedAt = /* @__PURE__ */ new Date(); const logger2 = getActionsLogger(); try { - await run5(startedAt); + await run6(startedAt); } catch (error3) { core21.setFailed( `${"resolve-environment" /* ResolveEnvironment */} action failed: ${getErrorMessage( @@ -187486,7 +187493,7 @@ async function sendCompletedStatusReport3(startedAt, toolsInput, toolsDownloadSt ); await sendStatusReport({ ...initStatusReport, ...initToolsDownloadFields }); } -async function run6(actionState) { +async function run7(actionState) { const { logger: logger2, startedAt } = actionState; let codeql; let toolsInput; @@ -187593,7 +187600,7 @@ async function run6(actionState) { } var setupCodeQL2 = { name: "setup-codeql" /* SetupCodeQL */, - run: run6 + run: run7 }; async function runWrapper7() { await runInActions(setupCodeQL2); @@ -188263,7 +188270,7 @@ async function checkConnections(logger2, proxy, backend) { } // src/start-proxy-action.ts -async function run7(action) { +async function run8(action) { const startedAt = action.startedAt; const logger2 = action.logger; let features; @@ -188338,7 +188345,7 @@ async function run7(action) { } var startProxyAction = { name: "start-proxy" /* StartProxy */, - run: run7, + run: run8, transformTelemetryError: getSafeErrorMessage }; async function runWrapper8() { @@ -188394,7 +188401,7 @@ async function startProxy(binPath, config, logFilePath, logger2) { // src/start-proxy-action-post.ts var core26 = __toESM(require_core()); -async function run8(action) { +async function run9(action) { const logger2 = action.logger; try { restoreInputs(logger2); @@ -188429,7 +188436,7 @@ async function run8(action) { } var startProxyPostAction = { name: "start-proxy-post" /* StartProxyPost */, - run: run8, + run: run9, transformTelemetryError: getSafeErrorMessage }; async function runWrapper9() { @@ -188455,7 +188462,7 @@ async function sendSuccessStatusReport2(startedAt, uploadStats, logger2) { await sendStatusReport(statusReport); } } -async function run9({ startedAt, logger: logger2 }) { +async function run10({ startedAt, logger: logger2 }) { try { initializeEnvironment(getActionVersion()); const gitHubVersion = await getGitHubVersion(); @@ -188540,7 +188547,7 @@ async function run9({ startedAt, logger: logger2 }) { } var uploadSarif = { name: "upload-sarif" /* UploadSarif */, - run: run9 + run: run10 }; async function runWrapper10() { await runInActions(uploadSarif); diff --git a/src/analyze-action-post.ts b/src/analyze-action-post.ts index a8d6dc4331..2c284554cd 100644 --- a/src/analyze-action-post.ts +++ b/src/analyze-action-post.ts @@ -7,6 +7,12 @@ import * as fs from "fs"; import * as core from "@actions/core"; +import { + ActionName, + runInActions, + type Action, + type ActionState, +} from "./action-common"; import * as actionsUtil from "./actions-util"; import { getGitHubVersion } from "./api-client"; import { getConfig } from "./config-utils"; @@ -16,15 +22,18 @@ import { getJavaTempDependencyDir, } from "./dependency-caching"; import { EnvVar } from "./environment"; -import { getActionsLogger } from "./logging"; import { checkGitHubVersionInRange, getErrorMessage } from "./util"; -export async function runWrapper() { +/** + * The main functionality of the `analyze` post-action is implemented by this function. + * This is called once by {@link runInActions} after it is called in {@link runWrapper}. + */ +export async function run(action: ActionState<["Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. + const logger = action.logger; try { - const logger = getActionsLogger(); actionsUtil.restoreInputs(logger); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger); @@ -68,3 +77,14 @@ export async function runWrapper() { ); } } + +/** Defines the `analyze` post-action. */ +const analyzePostAction: Action = { + name: ActionName.AnalyzePost, + run, +}; + +/** The main entry point for the `analyze` post-action. */ +export async function runWrapper() { + await runInActions(analyzePostAction); +} From 2a0f9f0e08b0dc6c1f7f47273691a0ea287687c7 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:41:47 +0100 Subject: [PATCH 05/10] Use `runInActions` for the `upload-sarif` post-action --- lib/entry-points.js | 95 ++++++++++++++++++--------------- src/upload-sarif-action-post.ts | 28 ++++++++-- 2 files changed, 75 insertions(+), 48 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 296ef9f4ae..65283cfaf1 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -28816,7 +28816,7 @@ var require_light = __commonJS({ } return this.Events.trigger("scheduled", { args: this.args, options: this.options }); } - async doExecute(chained, clearGlobalState, run11, free) { + async doExecute(chained, clearGlobalState, run12, free) { var error3, eventInfo, passed; if (this.retryCount === 0) { this._assertStatus("RUNNING"); @@ -28836,10 +28836,10 @@ var require_light = __commonJS({ } } catch (error1) { error3 = error1; - return this._onFailure(error3, eventInfo, clearGlobalState, run11, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run12, free); } } - doExpire(clearGlobalState, run11, free) { + doExpire(clearGlobalState, run12, free) { var error3, eventInfo; if (this._states.jobStatus(this.options.id === "RUNNING")) { this._states.next(this.options.id); @@ -28847,9 +28847,9 @@ var require_light = __commonJS({ this._assertStatus("EXECUTING"); eventInfo = { args: this.args, options: this.options, retryCount: this.retryCount }; error3 = new BottleneckError$1(`This job timed out after ${this.options.expiration} ms.`); - return this._onFailure(error3, eventInfo, clearGlobalState, run11, free); + return this._onFailure(error3, eventInfo, clearGlobalState, run12, free); } - async _onFailure(error3, eventInfo, clearGlobalState, run11, free) { + async _onFailure(error3, eventInfo, clearGlobalState, run12, free) { var retry2, retryAfter; if (clearGlobalState()) { retry2 = await this.Events.trigger("failed", error3, eventInfo); @@ -28857,7 +28857,7 @@ var require_light = __commonJS({ retryAfter = ~~retry2; this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo); this.retryCount++; - return run11(retryAfter); + return run12(retryAfter); } else { this.doDone(eventInfo); await free(this.options, eventInfo); @@ -29495,17 +29495,17 @@ var require_light = __commonJS({ } } _run(index2, job, wait) { - var clearGlobalState, free, run11; + var clearGlobalState, free, run12; job.doRun(); clearGlobalState = this._clearGlobalState.bind(this, index2); - run11 = this._run.bind(this, index2, job); + run12 = this._run.bind(this, index2, job); free = this._free.bind(this, index2, job); return this._scheduled[index2] = { timeout: setTimeout(() => { - return job.doExecute(this._limiter, clearGlobalState, run11, free); + return job.doExecute(this._limiter, clearGlobalState, run12, free); }, wait), expiration: job.options.expiration != null ? setTimeout(function() { - return job.doExpire(clearGlobalState, run11, free); + return job.doExpire(clearGlobalState, run12, free); }, wait + job.options.expiration) : void 0, job }; @@ -51046,14 +51046,14 @@ var require_crc64 = __commonJS({ missingLibrarySymbols.forEach(missingLibrarySymbol); var calledRun; dependenciesFulfilled = function runCaller() { - if (!calledRun) run11(); + if (!calledRun) run12(); if (!calledRun) dependenciesFulfilled = runCaller; }; function stackCheckInit() { _emscripten_stack_init(); writeStackCookie(); } - function run11(args) { + function run12(args) { args = args || arguments_; if (runDependencies > 0) { return; @@ -51111,7 +51111,7 @@ var require_crc64 = __commonJS({ Module["preInit"].pop()(); } } - run11(); + run12(); function WrapperObject() { } WrapperObject.prototype = Object.create(WrapperObject.prototype); @@ -114994,8 +114994,8 @@ var require_async = __commonJS({ return callback(null, results); } while (readyTasks.length && runningTasks < concurrency) { - var run11 = readyTasks.shift(); - run11(); + var run12 = readyTasks.shift(); + run12(); } } function addListener(taskName, fn) { @@ -179643,9 +179643,9 @@ async function addFingerprints(sarifLog, sourceRoot, logger2) { `Adding fingerprints to SARIF file. See ${"https://docs.github.com/en/code-security/reference/code-scanning/sarif-support-for-code-scanning#data-for-preventing-duplicated-alerts" /* TRACK_CODE_SCANNING_ALERTS_ACROSS_RUNS */} for more information.` ); const callbacksByFile = {}; - for (const run11 of sarifLog.runs || []) { - const artifacts = run11.artifacts || []; - for (const result of run11.results || []) { + for (const run12 of sarifLog.runs || []) { + const artifacts = run12.artifacts || []; + for (const result of run12.results || []) { const primaryLocation = (result.locations || [])[0]; if (!primaryLocation?.physicalLocation?.artifactLocation) { logger2.debug( @@ -179920,8 +179920,8 @@ var InvalidSarifUploadError = class extends Error { }; function getToolNames(sarifFile) { const toolNames = {}; - for (const run11 of sarifFile.runs || []) { - const tool = run11.tool || {}; + for (const run12 of sarifFile.runs || []) { + const tool = run12.tool || {}; const driver = tool.driver || {}; if (typeof driver.name === "string" && driver.name.length > 0) { toolNames[driver.name] = true; @@ -179961,17 +179961,17 @@ function combineSarifFiles(sarifFiles, logger2) { } function areAllRunsProducedByCodeQL(sarifLogs) { return sarifLogs.every((sarifLog) => { - return sarifLog.runs?.every((run11) => run11.tool?.driver?.name === "CodeQL"); + return sarifLog.runs?.every((run12) => run12.tool?.driver?.name === "CodeQL"); }); } -function createRunKey(run11) { +function createRunKey(run12) { return { - name: run11.tool?.driver?.name, - fullName: run11.tool?.driver?.fullName, - version: run11.tool?.driver?.version, - semanticVersion: run11.tool?.driver?.semanticVersion, - guid: run11.tool?.driver?.guid, - automationId: run11.automationDetails?.id + name: run12.tool?.driver?.name, + fullName: run12.tool?.driver?.fullName, + version: run12.tool?.driver?.version, + semanticVersion: run12.tool?.driver?.semanticVersion, + guid: run12.tool?.driver?.guid, + automationId: run12.automationDetails?.id }; } function areAllRunsUnique(sarifLogs) { @@ -179980,8 +179980,8 @@ function areAllRunsUnique(sarifLogs) { if (sarifLog.runs === void 0) { continue; } - for (const run11 of sarifLog.runs) { - const key = JSON.stringify(createRunKey(run11)); + for (const run12 of sarifLog.runs) { + const key = JSON.stringify(createRunKey(run12)); if (keys.has(key)) { return false; } @@ -180084,9 +180084,9 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo function populateRunAutomationDetails(sarifFile, category, analysis_key, environment) { const automationID = getAutomationID2(category, analysis_key, environment); if (automationID !== void 0) { - for (const run11 of sarifFile.runs || []) { - if (run11.automationDetails === void 0) { - run11.automationDetails = { + for (const run12 of sarifFile.runs || []) { + if (run12.automationDetails === void 0) { + run12.automationDetails = { id: automationID }; } @@ -180233,13 +180233,13 @@ function countResultsInSarif(sarifLog) { if (!Array.isArray(parsedSarif.runs)) { throw new InvalidSarifUploadError("Invalid SARIF. Missing 'runs' array."); } - for (const run11 of parsedSarif.runs) { - if (!Array.isArray(run11.results)) { + for (const run12 of parsedSarif.runs) { + if (!Array.isArray(run12.results)) { throw new InvalidSarifUploadError( "Invalid SARIF. Missing 'results' array in run." ); } - numResults += run11.results.length; + numResults += run12.results.length; } return numResults; } @@ -180566,9 +180566,9 @@ function handleProcessingResultForUnsuccessfulExecution(response, status, logger } function validateUniqueCategory(sarifLog, sentinelPrefix) { const categories = {}; - for (const run11 of sarifLog.runs || []) { - const id = run11?.automationDetails?.id; - const tool = run11.tool?.driver?.name; + for (const run12 of sarifLog.runs || []) { + const id = run12?.automationDetails?.id; + const tool = run12.tool?.driver?.name; const category = `${sanitize(id)}_${sanitize(tool)}`; categories[category] = { id, tool }; } @@ -180593,9 +180593,9 @@ function filterAlertsByDiffRange(logger2, sarifLog) { if (sarifLog.runs === void 0) { return sarifLog; } - for (const run11 of sarifLog.runs) { - if (run11.results) { - run11.results = run11.results.filter((result) => { + for (const run12 of sarifLog.runs) { + if (run12.results) { + run12.results = run12.results.filter((result) => { const locations = [ ...(result.locations || []).map((loc) => loc.physicalLocation), ...(result.relatedLocations || []).map((loc) => loc.physicalLocation) @@ -188555,9 +188555,9 @@ async function runWrapper10() { // src/upload-sarif-action-post.ts var core28 = __toESM(require_core()); -async function runWrapper11() { +async function run11(action) { + const logger2 = action.logger; try { - const logger2 = getActionsLogger(); restoreInputs(logger2); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); @@ -188579,6 +188579,13 @@ async function runWrapper11() { ); } } +var uploadSarifPostAction = { + name: "upload-sarif-post" /* UploadSarifPost */, + run: run11 +}; +async function runWrapper11() { + await runInActions(uploadSarifPostAction); +} // actions:entry-points async function runAnalyzeAction() { diff --git a/src/upload-sarif-action-post.ts b/src/upload-sarif-action-post.ts index 82961842e8..5e2ce338e5 100644 --- a/src/upload-sarif-action-post.ts +++ b/src/upload-sarif-action-post.ts @@ -5,20 +5,29 @@ */ import * as core from "@actions/core"; +import { + ActionName, + runInActions, + type Action, + type ActionState, +} from "./action-common"; import * as actionsUtil from "./actions-util"; import { getGitHubVersion } from "./api-client"; import * as debugArtifacts from "./debug-artifacts"; import { EnvVar } from "./environment"; -import { getActionsLogger, withGroup } from "./logging"; +import { withGroup } from "./logging"; import { checkGitHubVersionInRange, getErrorMessage } from "./util"; -export async function runWrapper() { +/** + * The main functionality of the `upload-sarif` post-action is implemented by this function. + * This is called once by {@link runInActions} after it is called in {@link runWrapper}. + */ +export async function run(action: ActionState<["Logger"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. + const logger = action.logger; try { - const logger = getActionsLogger(); - // Restore inputs from `upload-sarif` Action. actionsUtil.restoreInputs(logger); const gitHubVersion = await getGitHubVersion(); @@ -43,3 +52,14 @@ export async function runWrapper() { ); } } + +/** Defines the `upload-sarif` post-action. */ +const uploadSarifPostAction: Action = { + name: ActionName.UploadSarifPost, + run, +}; + +/** The main entry point for the `upload-sarif` post-action. */ +export async function runWrapper() { + await runInActions(uploadSarifPostAction); +} From 9d9422aff04ec426539c0bf511ffec5eadcc0b8d Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:44:39 +0100 Subject: [PATCH 06/10] Restore inputs in `runInActions` --- lib/entry-points.js | 17 +++++++++++++---- src/action-common.ts | 20 +++++++++++++++++++- src/analyze-action-post.ts | 1 - src/init-action-post.ts | 4 ---- src/start-proxy-action-post.ts | 3 --- src/upload-sarif-action-post.ts | 3 --- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 65283cfaf1..d8de64099c 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -171758,6 +171758,16 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error function extendActionState(state, extra) { return { ...state, ...extra }; } +function isPostAction(name) { + switch (name) { + case "analyze-post" /* AnalyzePost */: + case "init-post" /* InitPost */: + case "start-proxy-post" /* StartProxyPost */: + case "upload-sarif-post" /* UploadSarifPost */: + return true; + } + return false; +} async function runInActions(action) { const startedAt = /* @__PURE__ */ new Date(); const logger2 = getActionsLogger(); @@ -171773,6 +171783,9 @@ async function runInActions(action) { env, actions: actionsEnv }; + if (isPostAction(action.name)) { + restoreInputs(logger2); + } getJobUUID(actionState); await action.run(actionState); } catch (error3) { @@ -185902,7 +185915,6 @@ async function createDatabaseBundleCli(codeql, config, language) { async function run2(action) { const logger2 = action.logger; try { - restoreInputs(logger2); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] === "true") { @@ -187238,7 +187250,6 @@ async function run5(action) { let dependencyCachingUsage; try { const jobStatus2 = getOptionalInput("job-status"); - restoreInputs(logger2); const tmpDir = getTemporaryDirectory(); config = await getConfig(tmpDir, logger2); if (config === void 0) { @@ -188404,7 +188415,6 @@ var core26 = __toESM(require_core()); async function run9(action) { const logger2 = action.logger; try { - restoreInputs(logger2); const pid = core26.getState("proxy-process-pid"); if (pid) { process.kill(Number(pid)); @@ -188558,7 +188568,6 @@ var core28 = __toESM(require_core()); async function run11(action) { const logger2 = action.logger; try { - restoreInputs(logger2); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] !== "true") { diff --git a/src/action-common.ts b/src/action-common.ts index 360cb2bbbf..a86e5c2f84 100644 --- a/src/action-common.ts +++ b/src/action-common.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import { ActionsEnv, getActionsEnv } from "./actions-util"; +import { ActionsEnv, getActionsEnv, restoreInputs } from "./actions-util"; import type { ApiClient } from "./api-client"; import { Env, ReadOnlyEnv } from "./environment"; import type { FeatureEnablement } from "./feature-flags"; @@ -162,6 +162,19 @@ export interface Action { transformTelemetryError?: (error: Error) => string; } +/** Decides if {@link name} refers to a post-action. */ +function isPostAction(name: ActionName) { + switch (name) { + case ActionName.AnalyzePost: + case ActionName.InitPost: + case ActionName.StartProxyPost: + case ActionName.UploadSarifPost: + return true; + } + + return false; +} + /** A generic entry point that sets up the basic environment for the `action` and runs it. */ export async function runInActions(action: Action) { const startedAt = new Date(); @@ -180,6 +193,11 @@ export async function runInActions(action: Action) { actions: actionsEnv, }; + // If this is a post-action, restore inputs from the main action. + if (isPostAction(action.name)) { + restoreInputs(logger); + } + // Create a unique identifier for this run. getJobUUID(actionState); diff --git a/src/analyze-action-post.ts b/src/analyze-action-post.ts index 2c284554cd..46f8bbf0e8 100644 --- a/src/analyze-action-post.ts +++ b/src/analyze-action-post.ts @@ -34,7 +34,6 @@ export async function run(action: ActionState<["Logger"]>) { const logger = action.logger; try { - actionsUtil.restoreInputs(logger); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger); diff --git a/src/init-action-post.ts b/src/init-action-post.ts index 88aac46229..ba3c6d0d81 100644 --- a/src/init-action-post.ts +++ b/src/init-action-post.ts @@ -8,7 +8,6 @@ import * as core from "@actions/core"; import { runInActions, type Action, type ActionState } from "./action-common"; import { - restoreInputs, getOptionalInput, getTemporaryDirectory, printDebugLogs, @@ -66,9 +65,6 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) { // Action saw, which is always a success. const jobStatus = getOptionalInput("job-status"); - // Restore inputs from `init` Action. - restoreInputs(logger); - const tmpDir = getTemporaryDirectory(); config = await getConfig(tmpDir, logger); diff --git a/src/start-proxy-action-post.ts b/src/start-proxy-action-post.ts index 0b10afcbec..a9ead650ee 100644 --- a/src/start-proxy-action-post.ts +++ b/src/start-proxy-action-post.ts @@ -29,9 +29,6 @@ export async function run(action: ActionState<["Logger"]>) { const logger = action.logger; try { - // Restore inputs from `start-proxy` Action. - actionsUtil.restoreInputs(logger); - // Kill the running proxy const pid = core.getState("proxy-process-pid"); if (pid) { diff --git a/src/upload-sarif-action-post.ts b/src/upload-sarif-action-post.ts index 5e2ce338e5..265917e367 100644 --- a/src/upload-sarif-action-post.ts +++ b/src/upload-sarif-action-post.ts @@ -11,7 +11,6 @@ import { type Action, type ActionState, } from "./action-common"; -import * as actionsUtil from "./actions-util"; import { getGitHubVersion } from "./api-client"; import * as debugArtifacts from "./debug-artifacts"; import { EnvVar } from "./environment"; @@ -28,8 +27,6 @@ export async function run(action: ActionState<["Logger"]>) { const logger = action.logger; try { - // Restore inputs from `upload-sarif` Action. - actionsUtil.restoreInputs(logger); const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger); From 938d1c591f40726c873a2ac4170c7d2c4cf87433 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:59:14 +0100 Subject: [PATCH 07/10] Add `setFailed` to `ActionsEnv` --- lib/entry-points.js | 11 ++++++----- src/actions-util.ts | 2 ++ src/testing-utils.ts | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index d8de64099c..acde1abe5d 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -21649,7 +21649,7 @@ var require_core = __commonJS({ exports2.getBooleanInput = getBooleanInput; exports2.setOutput = setOutput7; exports2.setCommandEcho = setCommandEcho; - exports2.setFailed = setFailed12; + exports2.setFailed = setFailed13; exports2.isDebug = isDebug5; exports2.debug = debug6; exports2.error = error3; @@ -21733,7 +21733,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function setCommandEcho(enabled) { (0, command_1.issue)("echo", enabled ? "on" : "off"); } - function setFailed12(message) { + function setFailed13(message) { process.exitCode = ExitCode.Failure; error3(message); } @@ -145643,11 +145643,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issue)("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; - function setFailed12(message) { + function setFailed13(message) { process.exitCode = ExitCode.Failure; error3(message); } - exports2.setFailed = setFailed12; + exports2.setFailed = setFailed13; function isDebug5() { return process.env["RUNNER_DEBUG"] === "1"; } @@ -170132,7 +170132,8 @@ var Failure = class { function getActionsEnv() { return { getRequiredInput, - getOptionalInput + getOptionalInput, + setFailed: core4.setFailed }; } var getRequiredInput = function(name) { diff --git a/src/actions-util.ts b/src/actions-util.ts index 13e33a8e9d..bc1d85202e 100644 --- a/src/actions-util.ts +++ b/src/actions-util.ts @@ -30,6 +30,7 @@ declare const __CODEQL_ACTION_VERSION__: string; export interface ActionsEnv { getRequiredInput: (name: string) => string; getOptionalInput: (name: string) => string | undefined; + setFailed: (message: string) => void; } /** @@ -39,6 +40,7 @@ export function getActionsEnv(): ActionsEnv { return { getRequiredInput, getOptionalInput, + setFailed: core.setFailed, }; } diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 8c38187c4e..13110959bf 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -227,8 +227,13 @@ export function getTestEnv(testEnv: NodeJS.ProcessEnv = {}): Env { return getEnv(testEnv); } -/** An implementation of `ActionsEnv` for use in tests. */ +/** + * An implementation of {@link ActionsEnv} for use in tests. + * The methods of instances of this class are intended to be stubbed. + */ class TestActionsEnv implements ActionsEnv { + private failed: boolean = false; + constructor(private readonly env: Env) {} public clone(env: Env): this { @@ -242,6 +247,14 @@ class TestActionsEnv implements ActionsEnv { public getOptionalInput(_name: string): string | undefined { return undefined; } + + public setFailed(_message: string) { + this.failed = true; + } + + get hasFailed() { + return this.failed; + } } /** From 84bd5a897c2a0256393b8aa3a464f2308080bf8b Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 20:06:11 +0100 Subject: [PATCH 08/10] Add `getState` to `ActionsEnv` --- lib/entry-points.js | 3 ++- src/actions-util.ts | 2 ++ src/testing-utils.ts | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index acde1abe5d..a16d89a179 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -170133,7 +170133,8 @@ function getActionsEnv() { return { getRequiredInput, getOptionalInput, - setFailed: core4.setFailed + setFailed: core4.setFailed, + getState: core4.getState }; } var getRequiredInput = function(name) { diff --git a/src/actions-util.ts b/src/actions-util.ts index bc1d85202e..d2b7b2529a 100644 --- a/src/actions-util.ts +++ b/src/actions-util.ts @@ -31,6 +31,7 @@ export interface ActionsEnv { getRequiredInput: (name: string) => string; getOptionalInput: (name: string) => string | undefined; setFailed: (message: string) => void; + getState: (name: string) => string; } /** @@ -41,6 +42,7 @@ export function getActionsEnv(): ActionsEnv { getRequiredInput, getOptionalInput, setFailed: core.setFailed, + getState: core.getState, }; } diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 13110959bf..504fa28575 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -255,6 +255,10 @@ class TestActionsEnv implements ActionsEnv { get hasFailed() { return this.failed; } + + public getState(name: string): string { + throw new Error(`State '${name}' requested but not set.`); + } } /** From 6c74506460903bd5b275d3f3c15eca747ee0c3b9 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 20:13:23 +0100 Subject: [PATCH 09/10] Eliminate `core` imports from post-actions --- lib/entry-points.js | 684 ++++++++++++++++---------------- src/analyze-action-post.ts | 8 +- src/init-action-post.ts | 20 +- src/start-proxy-action-post.ts | 18 +- src/upload-sarif-action-post.ts | 10 +- 5 files changed, 361 insertions(+), 379 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index a16d89a179..b53ad2c522 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -21649,18 +21649,18 @@ var require_core = __commonJS({ exports2.getBooleanInput = getBooleanInput; exports2.setOutput = setOutput7; exports2.setCommandEcho = setCommandEcho; - exports2.setFailed = setFailed13; - exports2.isDebug = isDebug5; + exports2.setFailed = setFailed10; + exports2.isDebug = isDebug4; exports2.debug = debug6; exports2.error = error3; - exports2.warning = warning14; + exports2.warning = warning13; exports2.notice = notice; exports2.info = info8; exports2.startGroup = startGroup3; exports2.endGroup = endGroup3; exports2.group = group; exports2.saveState = saveState3; - exports2.getState = getState3; + exports2.getState = getState2; exports2.getIDToken = getIDToken; var command_1 = require_command(); var file_command_1 = require_file_command(); @@ -21733,11 +21733,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function setCommandEcho(enabled) { (0, command_1.issue)("echo", enabled ? "on" : "off"); } - function setFailed13(message) { + function setFailed10(message) { process.exitCode = ExitCode.Failure; error3(message); } - function isDebug5() { + function isDebug4() { return process.env["RUNNER_DEBUG"] === "1"; } function debug6(message) { @@ -21746,7 +21746,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function error3(message, properties = {}) { (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } - function warning14(message, properties = {}) { + function warning13(message, properties = {}) { (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } function notice(message, properties = {}) { @@ -21780,7 +21780,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); } - function getState3(name) { + function getState2(name) { return process.env[`STATE_${name}`] || ""; } function getIDToken(aud) { @@ -31294,7 +31294,7 @@ var require_internal_glob_options_helper = __commonJS({ })(); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getOptions = getOptions; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); function getOptions(copy) { const result = { followSymbolicLinks: true, @@ -31306,23 +31306,23 @@ var require_internal_glob_options_helper = __commonJS({ if (copy) { if (typeof copy.followSymbolicLinks === "boolean") { result.followSymbolicLinks = copy.followSymbolicLinks; - core29.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`); + core25.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`); } if (typeof copy.implicitDescendants === "boolean") { result.implicitDescendants = copy.implicitDescendants; - core29.debug(`implicitDescendants '${result.implicitDescendants}'`); + core25.debug(`implicitDescendants '${result.implicitDescendants}'`); } if (typeof copy.matchDirectories === "boolean") { result.matchDirectories = copy.matchDirectories; - core29.debug(`matchDirectories '${result.matchDirectories}'`); + core25.debug(`matchDirectories '${result.matchDirectories}'`); } if (typeof copy.omitBrokenSymbolicLinks === "boolean") { result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; - core29.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); + core25.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); } if (typeof copy.excludeHiddenFiles === "boolean") { result.excludeHiddenFiles = copy.excludeHiddenFiles; - core29.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`); + core25.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`); } } return result; @@ -33064,7 +33064,7 @@ var require_internal_globber = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultGlobber = void 0; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var fs32 = __importStar2(require("fs")); var globOptionsHelper = __importStar2(require_internal_glob_options_helper()); var path30 = __importStar2(require("path")); @@ -33117,7 +33117,7 @@ var require_internal_globber = __commonJS({ } const stack = []; for (const searchPath of patternHelper.getSearchPaths(patterns)) { - core29.debug(`Search path '${searchPath}'`); + core25.debug(`Search path '${searchPath}'`); try { yield __await2(fs32.promises.lstat(searchPath)); } catch (err) { @@ -33192,7 +33192,7 @@ var require_internal_globber = __commonJS({ } catch (err) { if (err.code === "ENOENT") { if (options.omitBrokenSymbolicLinks) { - core29.debug(`Broken symlink '${item.path}'`); + core25.debug(`Broken symlink '${item.path}'`); return void 0; } throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`); @@ -33208,7 +33208,7 @@ var require_internal_globber = __commonJS({ traversalChain.pop(); } if (traversalChain.some((x) => x === realPath)) { - core29.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`); + core25.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`); return void 0; } traversalChain.push(realPath); @@ -33311,7 +33311,7 @@ var require_internal_hash_files = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.hashFiles = hashFiles2; var crypto3 = __importStar2(require("crypto")); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var fs32 = __importStar2(require("fs")); var stream2 = __importStar2(require("stream")); var util4 = __importStar2(require("util")); @@ -33320,7 +33320,7 @@ var require_internal_hash_files = __commonJS({ return __awaiter2(this, arguments, void 0, function* (globber, currentWorkspace, verbose = false) { var _a6, e_1, _b2, _c2; var _d2; - const writeDelegate = verbose ? core29.info : core29.debug; + const writeDelegate = verbose ? core25.info : core25.debug; let hasMatch = false; const githubWorkspace = currentWorkspace ? currentWorkspace : (_d2 = process.env["GITHUB_WORKSPACE"]) !== null && _d2 !== void 0 ? _d2 : process.cwd(); const result = crypto3.createHash("sha256"); @@ -34712,7 +34712,7 @@ var require_cacheUtils = __commonJS({ exports2.assertDefined = assertDefined; exports2.getCacheVersion = getCacheVersion; exports2.getRuntimeToken = getRuntimeToken; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var exec3 = __importStar2(require_exec()); var glob2 = __importStar2(require_glob()); var io9 = __importStar2(require_io()); @@ -34763,7 +34763,7 @@ var require_cacheUtils = __commonJS({ _e2 = false; const file = _c2; const relativeFile = path30.relative(workspace, file).replace(new RegExp(`\\${path30.sep}`, "g"), "/"); - core29.debug(`Matched: ${relativeFile}`); + core25.debug(`Matched: ${relativeFile}`); if (relativeFile === "") { paths.push("."); } else { @@ -34791,7 +34791,7 @@ var require_cacheUtils = __commonJS({ return __awaiter2(this, arguments, void 0, function* (app, additionalArgs = []) { let versionOutput = ""; additionalArgs.push("--version"); - core29.debug(`Checking ${app} ${additionalArgs.join(" ")}`); + core25.debug(`Checking ${app} ${additionalArgs.join(" ")}`); try { yield exec3.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, @@ -34802,10 +34802,10 @@ var require_cacheUtils = __commonJS({ } }); } catch (err) { - core29.debug(err.message); + core25.debug(err.message); } versionOutput = versionOutput.trim(); - core29.debug(versionOutput); + core25.debug(versionOutput); return versionOutput; }); } @@ -34813,7 +34813,7 @@ var require_cacheUtils = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { const versionOutput = yield getVersion("zstd", ["--quiet"]); const version = semver11.clean(versionOutput); - core29.debug(`zstd version: ${version}`); + core25.debug(`zstd version: ${version}`); if (versionOutput === "") { return constants_1.CompressionMethod.Gzip; } else { @@ -34985,8 +34985,8 @@ var require_env = __commonJS({ function getEnvironmentVariable(name) { return import_node_process.default.env[name]; } - function emitNodeWarning(warning14) { - import_node_process.default.emitWarning(warning14); + function emitNodeWarning(warning13) { + import_node_process.default.emitWarning(warning13); } var isBrowser2 = false; var isWebWorker2 = false; @@ -39640,11 +39640,11 @@ var require_checkInsecureConnection = __commonJS({ return false; } function emitInsecureConnectionWarning() { - const warning14 = "Sending token over insecure transport. Assume any token issued is compromised."; - import_log.logger.warning(warning14); + const warning13 = "Sending token over insecure transport. Assume any token issued is compromised."; + import_log.logger.warning(warning13); if (!insecureConnectionWarningEmmitted) { insecureConnectionWarningEmmitted = true; - (0, import_env.emitNodeWarning)(warning14); + (0, import_env.emitNodeWarning)(warning13); } } function ensureSecureConnection(request3, options) { @@ -99036,7 +99036,7 @@ var require_uploadUtils = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UploadProgress = void 0; exports2.uploadCacheArchiveSDK = uploadCacheArchiveSDK; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var storage_blob_1 = require_commonjs15(); var errors_1 = require_errors2(); var UploadProgress = class { @@ -99078,7 +99078,7 @@ var require_uploadUtils = __commonJS({ const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1); const elapsedTime = Date.now() - this.startTime; const uploadSpeed = (transferredBytes / (1024 * 1024) / (elapsedTime / 1e3)).toFixed(1); - core29.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`); + core25.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`); if (this.isDone()) { this.displayedComplete = true; } @@ -99135,14 +99135,14 @@ var require_uploadUtils = __commonJS({ }; try { uploadProgress.startDisplayTimer(); - core29.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`); + core25.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`); const response = yield blockBlobClient.uploadFile(archivePath, uploadOptions); if (response._response.status >= 400) { throw new errors_1.InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${response._response.status}`); } return response; } catch (error3) { - core29.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error3.message}`); + core25.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error3.message}`); throw error3; } finally { uploadProgress.stopDisplayTimer(); @@ -99227,7 +99227,7 @@ var require_requestUtils = __commonJS({ exports2.retry = retry2; exports2.retryTypedResponse = retryTypedResponse; exports2.retryHttpClientResponse = retryHttpClientResponse; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var http_client_1 = require_lib(); var constants_1 = require_constants7(); function isSuccessStatusCode(statusCode) { @@ -99285,9 +99285,9 @@ var require_requestUtils = __commonJS({ isRetryable = isRetryableStatusCode(statusCode); errorMessage = `Cache service responded with ${statusCode}`; } - core29.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); + core25.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); if (!isRetryable) { - core29.debug(`${name} - Error is not retryable`); + core25.debug(`${name} - Error is not retryable`); break; } yield sleep(delay2); @@ -99546,7 +99546,7 @@ var require_downloadUtils = __commonJS({ exports2.downloadCacheHttpClient = downloadCacheHttpClient; exports2.downloadCacheHttpClientConcurrent = downloadCacheHttpClientConcurrent; exports2.downloadCacheStorageSDK = downloadCacheStorageSDK; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var http_client_1 = require_lib(); var storage_blob_1 = require_commonjs15(); var buffer = __importStar2(require("buffer")); @@ -99584,7 +99584,7 @@ var require_downloadUtils = __commonJS({ this.segmentIndex = this.segmentIndex + 1; this.segmentSize = segmentSize; this.receivedBytes = 0; - core29.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`); + core25.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`); } /** * Sets the number of bytes received for the current segment. @@ -99618,7 +99618,7 @@ var require_downloadUtils = __commonJS({ const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1); const elapsedTime = Date.now() - this.startTime; const downloadSpeed = (transferredBytes / (1024 * 1024) / (elapsedTime / 1e3)).toFixed(1); - core29.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`); + core25.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`); if (this.isDone()) { this.displayedComplete = true; } @@ -99668,7 +99668,7 @@ var require_downloadUtils = __commonJS({ })); downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => { downloadResponse.message.destroy(); - core29.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`); + core25.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`); }); yield pipeResponseToStream(downloadResponse, writeStream); const contentLengthHeader = downloadResponse.message.headers["content-length"]; @@ -99679,7 +99679,7 @@ var require_downloadUtils = __commonJS({ throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`); } } else { - core29.debug("Unable to validate download, no Content-Length header"); + core25.debug("Unable to validate download, no Content-Length header"); } }); } @@ -99797,7 +99797,7 @@ var require_downloadUtils = __commonJS({ const properties = yield client.getProperties(); const contentLength = (_a6 = properties.contentLength) !== null && _a6 !== void 0 ? _a6 : -1; if (contentLength < 0) { - core29.debug("Unable to determine content length, downloading file with http-client..."); + core25.debug("Unable to determine content length, downloading file with http-client..."); yield downloadCacheHttpClient(archiveLocation, archivePath); } else { const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); @@ -99887,7 +99887,7 @@ var require_options = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadOptions = getUploadOptions; exports2.getDownloadOptions = getDownloadOptions; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); function getUploadOptions(copy) { const result = { useAzureSdk: false, @@ -99907,9 +99907,9 @@ var require_options = __commonJS({ } result.uploadConcurrency = !isNaN(Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) ? Math.min(32, Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) : result.uploadConcurrency; result.uploadChunkSize = !isNaN(Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"])) ? Math.min(128 * 1024 * 1024, Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]) * 1024 * 1024) : result.uploadChunkSize; - core29.debug(`Use Azure SDK: ${result.useAzureSdk}`); - core29.debug(`Upload concurrency: ${result.uploadConcurrency}`); - core29.debug(`Upload chunk size: ${result.uploadChunkSize}`); + core25.debug(`Use Azure SDK: ${result.useAzureSdk}`); + core25.debug(`Upload concurrency: ${result.uploadConcurrency}`); + core25.debug(`Upload chunk size: ${result.uploadChunkSize}`); return result; } function getDownloadOptions(copy) { @@ -99945,12 +99945,12 @@ var require_options = __commonJS({ if (segmentDownloadTimeoutMins && !isNaN(Number(segmentDownloadTimeoutMins)) && isFinite(Number(segmentDownloadTimeoutMins))) { result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1e3; } - core29.debug(`Use Azure SDK: ${result.useAzureSdk}`); - core29.debug(`Download concurrency: ${result.downloadConcurrency}`); - core29.debug(`Request timeout (ms): ${result.timeoutInMs}`); - core29.debug(`Cache segment download timeout mins env var: ${process.env["SEGMENT_DOWNLOAD_TIMEOUT_MINS"]}`); - core29.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`); - core29.debug(`Lookup only: ${result.lookupOnly}`); + core25.debug(`Use Azure SDK: ${result.useAzureSdk}`); + core25.debug(`Download concurrency: ${result.downloadConcurrency}`); + core25.debug(`Request timeout (ms): ${result.timeoutInMs}`); + core25.debug(`Cache segment download timeout mins env var: ${process.env["SEGMENT_DOWNLOAD_TIMEOUT_MINS"]}`); + core25.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`); + core25.debug(`Lookup only: ${result.lookupOnly}`); return result; } } @@ -100161,7 +100161,7 @@ var require_cacheHttpClient = __commonJS({ exports2.downloadCache = downloadCache; exports2.reserveCache = reserveCache; exports2.saveCache = saveCache5; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); var fs32 = __importStar2(require("fs")); @@ -100180,7 +100180,7 @@ var require_cacheHttpClient = __commonJS({ throw new Error("Cache Service Url not found, unable to restore cache."); } const url2 = `${baseUrl}_apis/artifactcache/${resource}`; - core29.debug(`Resource Url: ${url2}`); + core25.debug(`Resource Url: ${url2}`); return url2; } function createAcceptHeader(type, apiVersion) { @@ -100209,7 +100209,7 @@ var require_cacheHttpClient = __commonJS({ return httpClient.getJson(getCacheApiUrl(resource)); })); if (response.statusCode === 204) { - if (core29.isDebug()) { + if (core25.isDebug()) { yield printCachesListForDiagnostics(keys[0], httpClient, version); } return null; @@ -100226,9 +100226,9 @@ var require_cacheHttpClient = __commonJS({ if (!cacheDownloadUrl) { throw new Error("Cache not found."); } - core29.setSecret(cacheDownloadUrl); - core29.debug(`Cache Result:`); - core29.debug(JSON.stringify(cacheResult)); + core25.setSecret(cacheDownloadUrl); + core25.debug(`Cache Result:`); + core25.debug(JSON.stringify(cacheResult)); return cacheResult; }); } @@ -100242,10 +100242,10 @@ var require_cacheHttpClient = __commonJS({ const cacheListResult = response.result; const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount; if (totalCount && totalCount > 0) { - core29.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key + core25.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key Other caches with similar key:`); for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) { - core29.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`); + core25.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`); } } } @@ -100288,7 +100288,7 @@ Other caches with similar key:`); } function uploadChunk(httpClient, resourceUrl, openStream, start, end) { return __awaiter2(this, void 0, void 0, function* () { - core29.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); + core25.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`); const additionalHeaders = { "Content-Type": "application/octet-stream", "Content-Range": getContentRange(start, end) @@ -100310,7 +100310,7 @@ Other caches with similar key:`); const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize); const parallelUploads = [...new Array(concurrency).keys()]; - core29.debug("Awaiting all uploads"); + core25.debug("Awaiting all uploads"); let offset = 0; try { yield Promise.all(parallelUploads.map(() => __awaiter2(this, void 0, void 0, function* () { @@ -100353,16 +100353,16 @@ Other caches with similar key:`); yield (0, uploadUtils_1.uploadCacheArchiveSDK)(signedUploadURL, archivePath, options); } else { const httpClient = createHttpClient(); - core29.debug("Upload cache"); + core25.debug("Upload cache"); yield uploadFile(httpClient, cacheId, archivePath, options); - core29.debug("Commiting cache"); + core25.debug("Commiting cache"); const cacheSize = utils.getArchiveFileSizeInBytes(archivePath); - core29.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`); + core25.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`); const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize); if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) { throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`); } - core29.info("Cache saved successfully"); + core25.info("Cache saved successfully"); } }); } @@ -105592,7 +105592,7 @@ var require_tar = __commonJS({ exports2.listTar = listTar; exports2.extractTar = extractTar3; exports2.createTar = createTar; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var exec_1 = require_exec(); var io9 = __importStar2(require_io()); var fs_1 = require("fs"); @@ -105759,7 +105759,7 @@ var require_tar = __commonJS({ try { yield io9.rmRF(tempDirectory); } catch (error3) { - core29.debug(`Failed to delete temporary tar directory: ${error3}`); + core25.debug(`Failed to delete temporary tar directory: ${error3}`); } } } @@ -105860,7 +105860,7 @@ var require_cache4 = __commonJS({ exports2.isFeatureAvailable = isFeatureAvailable; exports2.restoreCache = restoreCache5; exports2.saveCache = saveCache5; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var path30 = __importStar2(require("path")); var utils = __importStar2(require_cacheUtils()); var cacheHttpClient = __importStar2(require_cacheHttpClient()); @@ -105938,12 +105938,12 @@ var require_cache4 = __commonJS({ function restoreCache5(paths_1, primaryKey_1, restoreKeys_1, options_1) { return __awaiter2(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) { const cacheServiceVersion = (0, config_1.getCacheServiceVersion)(); - core29.debug(`Cache service version: ${cacheServiceVersion}`); + core25.debug(`Cache service version: ${cacheServiceVersion}`); checkPaths(paths); const cacheMode = (0, config_1.getCacheMode)(); if (!(0, config_1.isCacheReadable)(cacheMode)) { - core29.info(`Cache restore skipped: the effective cache-mode '${cacheMode}' does not permit reads.`); - core29.debug(`Skipped restore for paths [${paths.join(", ")}] with primary key '${primaryKey}'.`); + core25.info(`Cache restore skipped: the effective cache-mode '${cacheMode}' does not permit reads.`); + core25.debug(`Skipped restore for paths [${paths.join(", ")}] with primary key '${primaryKey}'.`); return void 0; } switch (cacheServiceVersion) { @@ -105960,8 +105960,8 @@ var require_cache4 = __commonJS({ var _a6; restoreKeys = restoreKeys || []; const keys = [primaryKey, ...restoreKeys]; - core29.debug("Resolved Keys:"); - core29.debug(JSON.stringify(keys)); + core25.debug("Resolved Keys:"); + core25.debug(JSON.stringify(keys)); if (keys.length > 10) { throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`); } @@ -105988,19 +105988,19 @@ var require_cache4 = __commonJS({ return void 0; } if (options === null || options === void 0 ? void 0 : options.lookupOnly) { - core29.info("Lookup only - skipping download"); + core25.info("Lookup only - skipping download"); return cacheEntry.cacheKey; } archivePath = path30.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); - core29.debug(`Archive Path: ${archivePath}`); + core25.debug(`Archive Path: ${archivePath}`); yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options); - if (core29.isDebug()) { + if (core25.isDebug()) { yield (0, tar_1.listTar)(archivePath, compressionMethod); } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); - core29.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); + core25.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); yield (0, tar_1.extractTar)(archivePath, compressionMethod); - core29.info("Cache restored successfully"); + core25.info("Cache restored successfully"); return cacheEntry.cacheKey; } catch (error3) { const typedError = error3; @@ -106008,16 +106008,16 @@ var require_cache4 = __commonJS({ throw error3; } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { - core29.error(`Failed to restore: ${error3.message}`); + core25.error(`Failed to restore: ${error3.message}`); } else { - core29.warning(`Failed to restore: ${error3.message}`); + core25.warning(`Failed to restore: ${error3.message}`); } } } finally { try { yield utils.unlinkFile(archivePath); } catch (error3) { - core29.debug(`Failed to delete archive: ${error3}`); + core25.debug(`Failed to delete archive: ${error3}`); } } return void 0; @@ -106029,8 +106029,8 @@ var require_cache4 = __commonJS({ options = Object.assign(Object.assign({}, options), { useAzureSdk: true }); restoreKeys = restoreKeys || []; const keys = [primaryKey, ...restoreKeys]; - core29.debug("Resolved Keys:"); - core29.debug(JSON.stringify(keys)); + core25.debug("Resolved Keys:"); + core25.debug(JSON.stringify(keys)); if (keys.length > 10) { throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`); } @@ -106057,30 +106057,30 @@ var require_cache4 = __commonJS({ throw error3; } if (!response.ok) { - core29.debug(`Cache not found for version ${request3.version} of keys: ${keys.join(", ")}`); + core25.debug(`Cache not found for version ${request3.version} of keys: ${keys.join(", ")}`); return void 0; } const isRestoreKeyMatch = request3.key !== response.matchedKey; if (isRestoreKeyMatch) { - core29.info(`Cache hit for restore-key: ${response.matchedKey}`); + core25.info(`Cache hit for restore-key: ${response.matchedKey}`); } else { - core29.info(`Cache hit for: ${response.matchedKey}`); + core25.info(`Cache hit for: ${response.matchedKey}`); } if (options === null || options === void 0 ? void 0 : options.lookupOnly) { - core29.info("Lookup only - skipping download"); + core25.info("Lookup only - skipping download"); return response.matchedKey; } archivePath = path30.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod)); - core29.debug(`Archive path: ${archivePath}`); - core29.debug(`Starting download of archive to: ${archivePath}`); + core25.debug(`Archive path: ${archivePath}`); + core25.debug(`Starting download of archive to: ${archivePath}`); yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options); const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); - core29.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); - if (core29.isDebug()) { + core25.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); + if (core25.isDebug()) { yield (0, tar_1.listTar)(archivePath, compressionMethod); } yield (0, tar_1.extractTar)(archivePath, compressionMethod); - core29.info("Cache restored successfully"); + core25.info("Cache restored successfully"); return response.matchedKey; } catch (error3) { const typedError = error3; @@ -106088,9 +106088,9 @@ var require_cache4 = __commonJS({ throw error3; } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { - core29.error(`Failed to restore: ${error3.message}`); + core25.error(`Failed to restore: ${error3.message}`); } else { - core29.warning(`Failed to restore: ${error3.message}`); + core25.warning(`Failed to restore: ${error3.message}`); } } } finally { @@ -106099,7 +106099,7 @@ var require_cache4 = __commonJS({ yield utils.unlinkFile(archivePath); } } catch (error3) { - core29.debug(`Failed to delete archive: ${error3}`); + core25.debug(`Failed to delete archive: ${error3}`); } } return void 0; @@ -106108,13 +106108,13 @@ var require_cache4 = __commonJS({ function saveCache5(paths_1, key_1, options_1) { return __awaiter2(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) { const cacheServiceVersion = (0, config_1.getCacheServiceVersion)(); - core29.debug(`Cache service version: ${cacheServiceVersion}`); + core25.debug(`Cache service version: ${cacheServiceVersion}`); checkPaths(paths); checkKey(key); const cacheMode = (0, config_1.getCacheMode)(); if (!(0, config_1.isCacheWritable)(cacheMode)) { - core29.info(`Cache save skipped: the effective cache-mode '${cacheMode}' does not permit writes.`); - core29.debug(`Skipped save for paths [${paths.join(", ")}] with key '${key}'.`); + core25.info(`Cache save skipped: the effective cache-mode '${cacheMode}' does not permit writes.`); + core25.debug(`Skipped save for paths [${paths.join(", ")}] with key '${key}'.`); return -1; } switch (cacheServiceVersion) { @@ -106132,26 +106132,26 @@ var require_cache4 = __commonJS({ const compressionMethod = yield utils.getCompressionMethod(); let cacheId = -1; const cachePaths = yield utils.resolvePaths(paths); - core29.debug("Cache Paths:"); - core29.debug(`${JSON.stringify(cachePaths)}`); + core25.debug("Cache Paths:"); + core25.debug(`${JSON.stringify(cachePaths)}`); if (cachePaths.length === 0) { throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); const archivePath = path30.join(archiveFolder, utils.getCacheFileName(compressionMethod)); - core29.debug(`Archive Path: ${archivePath}`); + core25.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); - if (core29.isDebug()) { + if (core25.isDebug()) { yield (0, tar_1.listTar)(archivePath, compressionMethod); } const fileSizeLimit = 10 * 1024 * 1024 * 1024; const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); - core29.debug(`File Size: ${archiveFileSize}`); + core25.debug(`File Size: ${archiveFileSize}`); if (archiveFileSize > fileSizeLimit && !(0, config_1.isGhes)()) { throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`); } - core29.debug("Reserving Cache"); + core25.debug("Reserving Cache"); const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, { compressionMethod, enableCrossOsArchive, @@ -106168,28 +106168,28 @@ var require_cache4 = __commonJS({ } throw new ReserveCacheError2(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`); } - core29.debug(`Saving Cache (ID: ${cacheId})`); + core25.debug(`Saving Cache (ID: ${cacheId})`); yield cacheHttpClient.saveCache(cacheId, archivePath, "", options); } catch (error3) { const typedError = error3; if (typedError.name === ValidationError.name) { throw error3; } else if (typedError.name === CacheWriteDeniedError.name) { - core29.warning(`Failed to save: ${typedError.message}`); + core25.warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError2.name) { - core29.info(`Failed to save: ${typedError.message}`); + core25.info(`Failed to save: ${typedError.message}`); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { - core29.error(`Failed to save: ${typedError.message}`); + core25.error(`Failed to save: ${typedError.message}`); } else { - core29.warning(`Failed to save: ${typedError.message}`); + core25.warning(`Failed to save: ${typedError.message}`); } } } finally { try { yield utils.unlinkFile(archivePath); } catch (error3) { - core29.debug(`Failed to delete archive: ${error3}`); + core25.debug(`Failed to delete archive: ${error3}`); } } return cacheId; @@ -106203,23 +106203,23 @@ var require_cache4 = __commonJS({ const twirpClient = cacheTwirpClient.internalCacheTwirpClient(); let cacheId = -1; const cachePaths = yield utils.resolvePaths(paths); - core29.debug("Cache Paths:"); - core29.debug(`${JSON.stringify(cachePaths)}`); + core25.debug("Cache Paths:"); + core25.debug(`${JSON.stringify(cachePaths)}`); if (cachePaths.length === 0) { throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`); } const archiveFolder = yield utils.createTempDirectory(); const archivePath = path30.join(archiveFolder, utils.getCacheFileName(compressionMethod)); - core29.debug(`Archive Path: ${archivePath}`); + core25.debug(`Archive Path: ${archivePath}`); try { yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod); - if (core29.isDebug()) { + if (core25.isDebug()) { yield (0, tar_1.listTar)(archivePath, compressionMethod); } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); - core29.debug(`File Size: ${archiveFileSize}`); + core25.debug(`File Size: ${archiveFileSize}`); options.archiveSizeBytes = archiveFileSize; - core29.debug("Reserving Cache"); + core25.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); const request3 = { key, @@ -106230,20 +106230,20 @@ var require_cache4 = __commonJS({ const response = yield twirpClient.CreateCacheEntry(request3); if (!response.ok) { if (response.message && !response.message.startsWith(exports2.CACHE_WRITE_DENIED_PREFIX)) { - core29.warning(`Cache reservation failed: ${response.message}`); + core25.warning(`Cache reservation failed: ${response.message}`); } throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error3) { - core29.debug(`Failed to reserve cache: ${error3}`); + core25.debug(`Failed to reserve cache: ${error3}`); const errorMessage = (_a6 = error3 === null || error3 === void 0 ? void 0 : error3.message) !== null && _a6 !== void 0 ? _a6 : ""; if (errorMessage.startsWith(exports2.CACHE_WRITE_DENIED_PREFIX)) { throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`); } throw new ReserveCacheError2(`Unable to reserve cache with key ${key}, another job may be creating this cache.`); } - core29.debug(`Attempting to upload cache located at: ${archivePath}`); + core25.debug(`Attempting to upload cache located at: ${archivePath}`); yield cacheHttpClient.saveCache(cacheId, archivePath, signedUploadUrl, options); const finalizeRequest = { key, @@ -106251,7 +106251,7 @@ var require_cache4 = __commonJS({ sizeBytes: `${archiveFileSize}` }; const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); - core29.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); + core25.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { if (finalizeResponse.message) { throw new FinalizeCacheError(finalizeResponse.message); @@ -106264,23 +106264,23 @@ var require_cache4 = __commonJS({ if (typedError.name === ValidationError.name) { throw error3; } else if (typedError.name === CacheWriteDeniedError.name) { - core29.warning(`Failed to save: ${typedError.message}`); + core25.warning(`Failed to save: ${typedError.message}`); } else if (typedError.name === ReserveCacheError2.name) { - core29.info(`Failed to save: ${typedError.message}`); + core25.info(`Failed to save: ${typedError.message}`); } else if (typedError.name === FinalizeCacheError.name) { - core29.warning(typedError.message); + core25.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { - core29.error(`Failed to save: ${typedError.message}`); + core25.error(`Failed to save: ${typedError.message}`); } else { - core29.warning(`Failed to save: ${typedError.message}`); + core25.warning(`Failed to save: ${typedError.message}`); } } } finally { try { yield utils.unlinkFile(archivePath); } catch (error3) { - core29.debug(`Failed to delete archive: ${error3}`); + core25.debug(`Failed to delete archive: ${error3}`); } } return cacheId; @@ -106507,7 +106507,7 @@ var require_retry_helper = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.RetryHelper = void 0; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var RetryHelper = class { constructor(maxAttempts, minSeconds, maxSeconds) { if (maxAttempts < 1) { @@ -106530,10 +106530,10 @@ var require_retry_helper = __commonJS({ if (isRetryable && !isRetryable(err)) { throw err; } - core29.info(err.message); + core25.info(err.message); } const seconds = this.getSleepAmount(); - core29.info(`Waiting ${seconds} seconds before trying again`); + core25.info(`Waiting ${seconds} seconds before trying again`); yield this.sleep(seconds); attempt++; } @@ -106636,7 +106636,7 @@ var require_tool_cache = __commonJS({ exports2.findFromManifest = findFromManifest; exports2.isExplicitVersion = isExplicitVersion; exports2.evaluateVersions = evaluateVersions; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var io9 = __importStar2(require_io()); var crypto3 = __importStar2(require("crypto")); var fs32 = __importStar2(require("fs")); @@ -106665,8 +106665,8 @@ var require_tool_cache = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { dest = dest || path30.join(_getTempDirectory(), crypto3.randomUUID()); yield io9.mkdirP(path30.dirname(dest)); - core29.debug(`Downloading ${url2}`); - core29.debug(`Destination ${dest}`); + core25.debug(`Downloading ${url2}`); + core25.debug(`Destination ${dest}`); const maxAttempts = 3; const minSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS", 10); const maxSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS", 20); @@ -106692,7 +106692,7 @@ var require_tool_cache = __commonJS({ allowRetries: false }); if (auth2) { - core29.debug("set auth"); + core25.debug("set auth"); if (headers === void 0) { headers = {}; } @@ -106701,7 +106701,7 @@ var require_tool_cache = __commonJS({ const response = yield http.get(url2, headers); if (response.message.statusCode !== 200) { const err = new HTTPError2(response.message.statusCode); - core29.debug(`Failed to download from "${url2}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); + core25.debug(`Failed to download from "${url2}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); throw err; } const pipeline2 = util4.promisify(stream2.pipeline); @@ -106710,16 +106710,16 @@ var require_tool_cache = __commonJS({ let succeeded = false; try { yield pipeline2(readStream, fs32.createWriteStream(dest)); - core29.debug("download complete"); + core25.debug("download complete"); succeeded = true; return dest; } finally { if (!succeeded) { - core29.debug("download failed"); + core25.debug("download failed"); try { yield io9.rmRF(dest); } catch (err) { - core29.debug(`Failed to delete '${dest}'. ${err.message}`); + core25.debug(`Failed to delete '${dest}'. ${err.message}`); } } } @@ -106734,7 +106734,7 @@ var require_tool_cache = __commonJS({ process.chdir(dest); if (_7zPath) { try { - const logLevel = core29.isDebug() ? "-bb1" : "-bb0"; + const logLevel = core25.isDebug() ? "-bb1" : "-bb0"; const args = [ "x", // eXtract files with full paths @@ -106787,7 +106787,7 @@ var require_tool_cache = __commonJS({ throw new Error("parameter 'file' is required"); } dest = yield _createExtractFolder(dest); - core29.debug("Checking tar --version"); + core25.debug("Checking tar --version"); let versionOutput = ""; yield (0, exec_1.exec)("tar --version", [], { ignoreReturnCode: true, @@ -106797,7 +106797,7 @@ var require_tool_cache = __commonJS({ stderr: (data) => versionOutput += data.toString() } }); - core29.debug(versionOutput.trim()); + core25.debug(versionOutput.trim()); const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR"); let args; if (flags instanceof Array) { @@ -106805,7 +106805,7 @@ var require_tool_cache = __commonJS({ } else { args = [flags]; } - if (core29.isDebug() && !flags.includes("v")) { + if (core25.isDebug() && !flags.includes("v")) { args.push("-v"); } let destArg = dest; @@ -106836,7 +106836,7 @@ var require_tool_cache = __commonJS({ args = [flags]; } args.push("-x", "-C", dest, "-f", file); - if (core29.isDebug()) { + if (core25.isDebug()) { args.push("-v"); } const xarPath = yield io9.which("xar", true); @@ -106879,7 +106879,7 @@ var require_tool_cache = __commonJS({ "-Command", pwshCommand ]; - core29.debug(`Using pwsh at path: ${pwshPath}`); + core25.debug(`Using pwsh at path: ${pwshPath}`); yield (0, exec_1.exec)(`"${pwshPath}"`, args); } else { const powershellCommand = [ @@ -106899,7 +106899,7 @@ var require_tool_cache = __commonJS({ powershellCommand ]; const powershellPath = yield io9.which("powershell", true); - core29.debug(`Using powershell at path: ${powershellPath}`); + core25.debug(`Using powershell at path: ${powershellPath}`); yield (0, exec_1.exec)(`"${powershellPath}"`, args); } }); @@ -106908,7 +106908,7 @@ var require_tool_cache = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { const unzipPath = yield io9.which("unzip", true); const args = [file]; - if (!core29.isDebug()) { + if (!core25.isDebug()) { args.unshift("-q"); } args.unshift("-o"); @@ -106919,8 +106919,8 @@ var require_tool_cache = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { version = semver11.clean(version) || version; arch2 = arch2 || os7.arch(); - core29.debug(`Caching tool ${tool} ${version} ${arch2}`); - core29.debug(`source dir: ${sourceDir}`); + core25.debug(`Caching tool ${tool} ${version} ${arch2}`); + core25.debug(`source dir: ${sourceDir}`); if (!fs32.statSync(sourceDir).isDirectory()) { throw new Error("sourceDir is not a directory"); } @@ -106937,14 +106937,14 @@ var require_tool_cache = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { version = semver11.clean(version) || version; arch2 = arch2 || os7.arch(); - core29.debug(`Caching tool ${tool} ${version} ${arch2}`); - core29.debug(`source file: ${sourceFile}`); + core25.debug(`Caching tool ${tool} ${version} ${arch2}`); + core25.debug(`source file: ${sourceFile}`); if (!fs32.statSync(sourceFile).isFile()) { throw new Error("sourceFile is not a file"); } const destFolder = yield _createToolPath(tool, version, arch2); const destPath = path30.join(destFolder, targetFile); - core29.debug(`destination file ${destPath}`); + core25.debug(`destination file ${destPath}`); yield io9.cp(sourceFile, destPath); _completeToolPath(tool, version, arch2); return destFolder; @@ -106967,12 +106967,12 @@ var require_tool_cache = __commonJS({ if (versionSpec) { versionSpec = semver11.clean(versionSpec) || ""; const cachePath = path30.join(_getCacheDirectory(), toolName, versionSpec, arch2); - core29.debug(`checking cache: ${cachePath}`); + core25.debug(`checking cache: ${cachePath}`); if (fs32.existsSync(cachePath) && fs32.existsSync(`${cachePath}.complete`)) { - core29.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`); + core25.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`); toolPath = cachePath; } else { - core29.debug("not found"); + core25.debug("not found"); } } return toolPath; @@ -107001,7 +107001,7 @@ var require_tool_cache = __commonJS({ const http = new httpm.HttpClient("tool-cache"); const headers = {}; if (auth2) { - core29.debug("set auth"); + core25.debug("set auth"); headers.authorization = auth2; } const response = yield http.getJson(treeUrl, headers); @@ -107022,7 +107022,7 @@ var require_tool_cache = __commonJS({ try { releases = JSON.parse(versionsRaw); } catch (_a6) { - core29.debug("Invalid json"); + core25.debug("Invalid json"); } } return releases; @@ -107046,7 +107046,7 @@ var require_tool_cache = __commonJS({ function _createToolPath(tool, version, arch2) { return __awaiter2(this, void 0, void 0, function* () { const folderPath = path30.join(_getCacheDirectory(), tool, semver11.clean(version) || version, arch2 || ""); - core29.debug(`destination ${folderPath}`); + core25.debug(`destination ${folderPath}`); const markerPath = `${folderPath}.complete`; yield io9.rmRF(folderPath); yield io9.rmRF(markerPath); @@ -107058,18 +107058,18 @@ var require_tool_cache = __commonJS({ const folderPath = path30.join(_getCacheDirectory(), tool, semver11.clean(version) || version, arch2 || ""); const markerPath = `${folderPath}.complete`; fs32.writeFileSync(markerPath, ""); - core29.debug("finished caching tool"); + core25.debug("finished caching tool"); } function isExplicitVersion(versionSpec) { const c = semver11.clean(versionSpec) || ""; - core29.debug(`isExplicit: ${c}`); + core25.debug(`isExplicit: ${c}`); const valid4 = semver11.valid(c) != null; - core29.debug(`explicit? ${valid4}`); + core25.debug(`explicit? ${valid4}`); return valid4; } function evaluateVersions(versions, versionSpec) { let version = ""; - core29.debug(`evaluating ${versions.length} versions`); + core25.debug(`evaluating ${versions.length} versions`); versions = versions.sort((a, b) => { if (semver11.gt(a, b)) { return 1; @@ -107085,9 +107085,9 @@ var require_tool_cache = __commonJS({ } } if (version) { - core29.debug(`matched: ${version}`); + core25.debug(`matched: ${version}`); } else { - core29.debug("match not found"); + core25.debug("match not found"); } return version; } @@ -112651,14 +112651,14 @@ var require_retention = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getExpiration = void 0; var generated_1 = require_generated(); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); function getExpiration(retentionDays) { if (!retentionDays) { return void 0; } const maxRetentionDays = getRetentionDays(); if (maxRetentionDays && maxRetentionDays < retentionDays) { - core29.warning(`Retention days cannot be greater than the maximum allowed retention set within the repository. Using ${maxRetentionDays} instead.`); + core25.warning(`Retention days cannot be greater than the maximum allowed retention set within the repository. Using ${maxRetentionDays} instead.`); retentionDays = maxRetentionDays; } const expirationDate = /* @__PURE__ */ new Date(); @@ -112996,7 +112996,7 @@ var require_util11 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.maskSecretUrls = exports2.maskSigUrl = exports2.getBackendIdsFromToken = void 0; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var config_1 = require_config2(); var jwt_decode_1 = __importDefault2(require_jwt_decode_cjs()); var core_1 = require_core(); @@ -113023,8 +113023,8 @@ var require_util11 = __commonJS({ workflowRunBackendId: scopeParts[1], workflowJobRunBackendId: scopeParts[2] }; - core29.debug(`Workflow Run Backend ID: ${ids.workflowRunBackendId}`); - core29.debug(`Workflow Job Run Backend ID: ${ids.workflowJobRunBackendId}`); + core25.debug(`Workflow Run Backend ID: ${ids.workflowRunBackendId}`); + core25.debug(`Workflow Job Run Backend ID: ${ids.workflowJobRunBackendId}`); return ids; } throw InvalidJwtError; @@ -113384,7 +113384,7 @@ var require_blob_upload = __commonJS({ exports2.uploadZipToBlobStorage = void 0; var storage_blob_1 = require_commonjs15(); var config_1 = require_config2(); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var crypto3 = __importStar2(require("crypto")); var stream2 = __importStar2(require("stream")); var errors_1 = require_errors3(); @@ -113410,9 +113410,9 @@ var require_blob_upload = __commonJS({ const bufferSize = (0, config_1.getUploadChunkSize)(); const blobClient = new storage_blob_1.BlobClient(authenticatedUploadURL); const blockBlobClient = blobClient.getBlockBlobClient(); - core29.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`); + core25.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`); const uploadCallback = (progress) => { - core29.info(`Uploaded bytes ${progress.loadedBytes}`); + core25.info(`Uploaded bytes ${progress.loadedBytes}`); uploadByteCount = progress.loadedBytes; lastProgressTime = Date.now(); }; @@ -113426,7 +113426,7 @@ var require_blob_upload = __commonJS({ const hashStream = crypto3.createHash("sha256"); zipUploadStream.pipe(uploadStream); zipUploadStream.pipe(hashStream).setEncoding("hex"); - core29.info("Beginning upload of artifact content to blob storage"); + core25.info("Beginning upload of artifact content to blob storage"); try { yield Promise.race([ blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options), @@ -113440,12 +113440,12 @@ var require_blob_upload = __commonJS({ } finally { abortController.abort(); } - core29.info("Finished uploading artifact content to blob storage!"); + core25.info("Finished uploading artifact content to blob storage!"); hashStream.end(); sha256Hash = hashStream.read(); - core29.info(`SHA256 digest of uploaded artifact zip is ${sha256Hash}`); + core25.info(`SHA256 digest of uploaded artifact zip is ${sha256Hash}`); if (uploadByteCount === 0) { - core29.warning(`No data was uploaded to blob storage. Reported upload byte count is 0.`); + core25.warning(`No data was uploaded to blob storage. Reported upload byte count is 0.`); } return { uploadSize: uploadByteCount, @@ -135099,7 +135099,7 @@ var require_zip2 = __commonJS({ var stream2 = __importStar2(require("stream")); var promises_1 = require("fs/promises"); var archiver = __importStar2(require_archiver()); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var config_1 = require_config2(); exports2.DEFAULT_COMPRESSION_LEVEL = 6; var ZipUploadStream = class extends stream2.Transform { @@ -135116,7 +135116,7 @@ var require_zip2 = __commonJS({ exports2.ZipUploadStream = ZipUploadStream; function createZipUploadStream(uploadSpecification_1) { return __awaiter2(this, arguments, void 0, function* (uploadSpecification, compressionLevel = exports2.DEFAULT_COMPRESSION_LEVEL) { - core29.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`); + core25.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`); const zip = archiver.create("zip", { highWaterMark: (0, config_1.getUploadChunkSize)(), zlib: { level: compressionLevel } @@ -135140,8 +135140,8 @@ var require_zip2 = __commonJS({ } const bufferSize = (0, config_1.getUploadChunkSize)(); const zipUploadStream = new ZipUploadStream(bufferSize); - core29.debug(`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`); - core29.debug(`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`); + core25.debug(`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`); + core25.debug(`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`); zip.pipe(zipUploadStream); zip.finalize(); return zipUploadStream; @@ -135149,24 +135149,24 @@ var require_zip2 = __commonJS({ } exports2.createZipUploadStream = createZipUploadStream; var zipErrorCallback = (error3) => { - core29.error("An error has occurred while creating the zip file for upload"); - core29.info(error3); + core25.error("An error has occurred while creating the zip file for upload"); + core25.info(error3); throw new Error("An error has occurred during zip creation for the artifact"); }; var zipWarningCallback = (error3) => { if (error3.code === "ENOENT") { - core29.warning("ENOENT warning during artifact zip creation. No such file or directory"); - core29.info(error3); + core25.warning("ENOENT warning during artifact zip creation. No such file or directory"); + core25.info(error3); } else { - core29.warning(`A non-blocking warning has occurred during artifact zip creation: ${error3.code}`); - core29.info(error3); + core25.warning(`A non-blocking warning has occurred during artifact zip creation: ${error3.code}`); + core25.info(error3); } }; var zipFinishCallback = () => { - core29.debug("Zip stream for upload has finished."); + core25.debug("Zip stream for upload has finished."); }; var zipEndCallback = () => { - core29.debug("Zip stream for upload has ended."); + core25.debug("Zip stream for upload has ended."); }; } }); @@ -135231,7 +135231,7 @@ var require_upload_artifact = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.uploadArtifact = void 0; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var retention_1 = require_retention(); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation(); var artifact_twirp_client_1 = require_artifact_twirp_client2(); @@ -135278,13 +135278,13 @@ var require_upload_artifact = __commonJS({ value: `sha256:${uploadResult.sha256Hash}` }); } - core29.info(`Finalizing artifact upload`); + core25.info(`Finalizing artifact upload`); const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq); if (!finalizeArtifactResp.ok) { throw new errors_1.InvalidResponseError("FinalizeArtifact: response from backend was not ok"); } const artifactId = BigInt(finalizeArtifactResp.artifactId); - core29.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`); + core25.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`); return { size: uploadResult.uploadSize, digest: uploadResult.sha256Hash, @@ -142008,7 +142008,7 @@ var require_download_artifact = __commonJS({ var crypto3 = __importStar2(require("crypto")); var stream2 = __importStar2(require("stream")); var github5 = __importStar2(require_github2()); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var httpClient = __importStar2(require_lib()); var unzip_stream_1 = __importDefault2(require_unzip()); var user_agent_1 = require_user_agent2(); @@ -142044,7 +142044,7 @@ var require_download_artifact = __commonJS({ return yield streamExtractExternal(url2, directory); } catch (error3) { retryCount++; - core29.debug(`Failed to download artifact after ${retryCount} retries due to ${error3.message}. Retrying in 5 seconds...`); + core25.debug(`Failed to download artifact after ${retryCount} retries due to ${error3.message}. Retrying in 5 seconds...`); yield new Promise((resolve15) => setTimeout(resolve15, 5e3)); } } @@ -142074,7 +142074,7 @@ var require_download_artifact = __commonJS({ extractStream.on("data", () => { timer.refresh(); }).on("error", (error3) => { - core29.debug(`response.message: Artifact download failed: ${error3.message}`); + core25.debug(`response.message: Artifact download failed: ${error3.message}`); clearTimeout(timer); reject(error3); }).pipe(unzip_stream_1.default.Extract({ path: directory })).on("close", () => { @@ -142082,7 +142082,7 @@ var require_download_artifact = __commonJS({ if (hashStream) { hashStream.end(); sha256Digest = hashStream.read(); - core29.info(`SHA256 digest of downloaded artifact is ${sha256Digest}`); + core25.info(`SHA256 digest of downloaded artifact is ${sha256Digest}`); } resolve15({ sha256Digest: `sha256:${sha256Digest}` }); }).on("error", (error3) => { @@ -142097,7 +142097,7 @@ var require_download_artifact = __commonJS({ const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path); const api = github5.getOctokit(token); let digestMismatch = false; - core29.info(`Downloading artifact '${artifactId}' from '${repositoryOwner}/${repositoryName}'`); + core25.info(`Downloading artifact '${artifactId}' from '${repositoryOwner}/${repositoryName}'`); const { headers, status } = yield api.rest.actions.downloadArtifact({ owner: repositoryOwner, repo: repositoryName, @@ -142114,16 +142114,16 @@ var require_download_artifact = __commonJS({ if (!location) { throw new Error(`Unable to redirect to artifact download url`); } - core29.info(`Redirecting to blob download url: ${scrubQueryParameters(location)}`); + core25.info(`Redirecting to blob download url: ${scrubQueryParameters(location)}`); try { - core29.info(`Starting download of artifact to: ${downloadPath}`); + core25.info(`Starting download of artifact to: ${downloadPath}`); const extractResponse = yield streamExtract(location, downloadPath); - core29.info(`Artifact download completed successfully.`); + core25.info(`Artifact download completed successfully.`); if (options === null || options === void 0 ? void 0 : options.expectedHash) { if ((options === null || options === void 0 ? void 0 : options.expectedHash) !== extractResponse.sha256Digest) { digestMismatch = true; - core29.debug(`Computed digest: ${extractResponse.sha256Digest}`); - core29.debug(`Expected digest: ${options.expectedHash}`); + core25.debug(`Computed digest: ${extractResponse.sha256Digest}`); + core25.debug(`Expected digest: ${options.expectedHash}`); } } } catch (error3) { @@ -142150,7 +142150,7 @@ var require_download_artifact = __commonJS({ Are you trying to download from a different run? Try specifying a github-token with \`actions:read\` scope.`); } if (artifacts.length > 1) { - core29.warning("Multiple artifacts found, defaulting to first."); + core25.warning("Multiple artifacts found, defaulting to first."); } const signedReq = { workflowRunBackendId: artifacts[0].workflowRunBackendId, @@ -142158,16 +142158,16 @@ Are you trying to download from a different run? Try specifying a github-token w name: artifacts[0].name }; const { signedUrl } = yield artifactClient.GetSignedArtifactURL(signedReq); - core29.info(`Redirecting to blob download url: ${scrubQueryParameters(signedUrl)}`); + core25.info(`Redirecting to blob download url: ${scrubQueryParameters(signedUrl)}`); try { - core29.info(`Starting download of artifact to: ${downloadPath}`); + core25.info(`Starting download of artifact to: ${downloadPath}`); const extractResponse = yield streamExtract(signedUrl, downloadPath); - core29.info(`Artifact download completed successfully.`); + core25.info(`Artifact download completed successfully.`); if (options === null || options === void 0 ? void 0 : options.expectedHash) { if ((options === null || options === void 0 ? void 0 : options.expectedHash) !== extractResponse.sha256Digest) { digestMismatch = true; - core29.debug(`Computed digest: ${extractResponse.sha256Digest}`); - core29.debug(`Expected digest: ${options.expectedHash}`); + core25.debug(`Computed digest: ${extractResponse.sha256Digest}`); + core25.debug(`Expected digest: ${options.expectedHash}`); } } } catch (error3) { @@ -142180,10 +142180,10 @@ Are you trying to download from a different run? Try specifying a github-token w function resolveOrCreateDirectory() { return __awaiter2(this, arguments, void 0, function* (downloadPath = (0, config_1.getGitHubWorkspaceDir)()) { if (!(yield exists(downloadPath))) { - core29.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`); + core25.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`); yield promises_1.default.mkdir(downloadPath, { recursive: true }); } else { - core29.debug(`Artifact destination folder already exists: ${downloadPath}`); + core25.debug(`Artifact destination folder already exists: ${downloadPath}`); } return downloadPath; }); @@ -142224,7 +142224,7 @@ var require_retry_options = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getRetryOptions = void 0; - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var defaultMaxRetryNumber = 5; var defaultExemptStatusCodes = [400, 401, 403, 404, 422]; function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exemptStatusCodes = defaultExemptStatusCodes) { @@ -142239,7 +142239,7 @@ var require_retry_options = __commonJS({ retryOptions.doNotRetry = exemptStatusCodes; } const requestOptions = Object.assign(Object.assign({}, defaultOptions.request), { retries }); - core29.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a6 = retryOptions.doNotRetry) !== null && _a6 !== void 0 ? _a6 : "octokit default: [400, 401, 403, 404, 422]"})`); + core25.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a6 = retryOptions.doNotRetry) !== null && _a6 !== void 0 ? _a6 : "octokit default: [400, 401, 403, 404, 422]"})`); return [retryOptions, requestOptions]; } exports2.getRetryOptions = getRetryOptions; @@ -142396,7 +142396,7 @@ var require_get_artifact = __commonJS({ exports2.getArtifactInternal = exports2.getArtifactPublic = void 0; var github_1 = require_github2(); var plugin_retry_1 = require_dist_node12(); - var core29 = __importStar2(require_core()); + var core25 = __importStar2(require_core()); var utils_1 = require_utils10(); var retry_options_1 = require_retry_options(); var plugin_request_log_1 = require_dist_node11(); @@ -142434,7 +142434,7 @@ var require_get_artifact = __commonJS({ let artifact2 = getArtifactResp.data.artifacts[0]; if (getArtifactResp.data.artifacts.length > 1) { artifact2 = getArtifactResp.data.artifacts.sort((a, b) => b.id - a.id)[0]; - core29.debug(`More than one artifact found for a single name, returning newest (id: ${artifact2.id})`); + core25.debug(`More than one artifact found for a single name, returning newest (id: ${artifact2.id})`); } return { artifact: { @@ -142467,7 +142467,7 @@ var require_get_artifact = __commonJS({ let artifact2 = res.artifacts[0]; if (res.artifacts.length > 1) { artifact2 = res.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0]; - core29.debug(`More than one artifact found for a single name, returning newest (id: ${artifact2.databaseId})`); + core25.debug(`More than one artifact found for a single name, returning newest (id: ${artifact2.databaseId})`); } return { artifact: { @@ -145643,15 +145643,15 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issue)("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; - function setFailed13(message) { + function setFailed10(message) { process.exitCode = ExitCode.Failure; error3(message); } - exports2.setFailed = setFailed13; - function isDebug5() { + exports2.setFailed = setFailed10; + function isDebug4() { return process.env["RUNNER_DEBUG"] === "1"; } - exports2.isDebug = isDebug5; + exports2.isDebug = isDebug4; function debug6(message) { (0, command_1.issueCommand)("debug", {}, message); } @@ -145660,10 +145660,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.error = error3; - function warning14(message, properties = {}) { + function warning13(message, properties = {}) { (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } - exports2.warning = warning14; + exports2.warning = warning13; function notice(message, properties = {}) { (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } @@ -145701,10 +145701,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); } exports2.saveState = saveState3; - function getState3(name) { + function getState2(name) { return process.env[`STATE_${name}`] || ""; } - exports2.getState = getState3; + exports2.getState = getState2; function getIDToken(aud) { return __awaiter2(this, void 0, void 0, function* () { return yield oidc_utils_1.OidcClient.getIDToken(aud); @@ -147221,7 +147221,7 @@ var require_requestUtils2 = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.retryHttpClientRequest = exports2.retry = void 0; var utils_1 = require_utils12(); - var core29 = __importStar2(require_core3()); + var core25 = __importStar2(require_core3()); var config_variables_1 = require_config_variables(); function retry2(name, operation, customErrorMessages, maxAttempts) { return __awaiter2(this, void 0, void 0, function* () { @@ -147248,13 +147248,13 @@ var require_requestUtils2 = __commonJS({ errorMessage = error3.message; } if (!isRetryable) { - core29.info(`${name} - Error is not retryable`); + core25.info(`${name} - Error is not retryable`); if (response) { (0, utils_1.displayHttpDiagnostics)(response); } break; } - core29.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); + core25.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); yield (0, utils_1.sleep)((0, utils_1.getExponentialRetryTimeInMilliseconds)(attempt)); attempt++; } @@ -147338,7 +147338,7 @@ var require_upload_http_client = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UploadHttpClient = void 0; var fs32 = __importStar2(require("fs")); - var core29 = __importStar2(require_core3()); + var core25 = __importStar2(require_core3()); var tmp2 = __importStar2(require_tmp_promise()); var stream2 = __importStar2(require("stream")); var utils_1 = require_utils12(); @@ -147403,7 +147403,7 @@ var require_upload_http_client = __commonJS({ return __awaiter2(this, void 0, void 0, function* () { const FILE_CONCURRENCY = (0, config_variables_1.getUploadFileConcurrency)(); const MAX_CHUNK_SIZE = (0, config_variables_1.getUploadChunkSize)(); - core29.debug(`File Concurrency: ${FILE_CONCURRENCY}, and Chunk Size: ${MAX_CHUNK_SIZE}`); + core25.debug(`File Concurrency: ${FILE_CONCURRENCY}, and Chunk Size: ${MAX_CHUNK_SIZE}`); const parameters = []; let continueOnError = true; if (options) { @@ -147440,15 +147440,15 @@ var require_upload_http_client = __commonJS({ } const startTime = perf_hooks_1.performance.now(); const uploadFileResult = yield this.uploadFileAsync(index2, currentFileParameters); - if (core29.isDebug()) { - core29.debug(`File: ${++completedFiles}/${filesToUpload.length}. ${currentFileParameters.file} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish upload`); + if (core25.isDebug()) { + core25.debug(`File: ${++completedFiles}/${filesToUpload.length}. ${currentFileParameters.file} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish upload`); } uploadFileSize += uploadFileResult.successfulUploadSize; totalFileSize += uploadFileResult.totalSize; if (uploadFileResult.isSuccess === false) { failedItemsToReport.push(currentFileParameters.file); if (!continueOnError) { - core29.error(`aborting artifact upload`); + core25.error(`aborting artifact upload`); abortPendingFileUploads = true; } } @@ -147457,7 +147457,7 @@ var require_upload_http_client = __commonJS({ }))); this.statusReporter.stop(); this.uploadHttpManager.disposeAndReplaceAllClients(); - core29.info(`Total size of all the files uploaded is ${uploadFileSize} bytes`); + core25.info(`Total size of all the files uploaded is ${uploadFileSize} bytes`); return { uploadSize: uploadFileSize, totalSize: totalFileSize, @@ -147483,16 +147483,16 @@ var require_upload_http_client = __commonJS({ let uploadFileSize = 0; let isGzip = true; if (!isFIFO && totalFileSize < 65536) { - core29.debug(`${parameters.file} is less than 64k in size. Creating a gzip file in-memory to potentially reduce the upload size`); + core25.debug(`${parameters.file} is less than 64k in size. Creating a gzip file in-memory to potentially reduce the upload size`); const buffer = yield (0, upload_gzip_1.createGZipFileInBuffer)(parameters.file); let openUploadStream; if (totalFileSize < buffer.byteLength) { - core29.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); + core25.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); openUploadStream = () => fs32.createReadStream(parameters.file); isGzip = false; uploadFileSize = totalFileSize; } else { - core29.debug(`A gzip file created for ${parameters.file} helped with reducing the size of the original file. The file will be uploaded using gzip.`); + core25.debug(`A gzip file created for ${parameters.file} helped with reducing the size of the original file. The file will be uploaded using gzip.`); openUploadStream = () => { const passThrough = new stream2.PassThrough(); passThrough.end(buffer); @@ -147504,7 +147504,7 @@ var require_upload_http_client = __commonJS({ if (!result) { isUploadSuccessful = false; failedChunkSizes += uploadFileSize; - core29.warning(`Aborting upload for ${parameters.file} due to failure`); + core25.warning(`Aborting upload for ${parameters.file} due to failure`); } return { isSuccess: isUploadSuccessful, @@ -147513,16 +147513,16 @@ var require_upload_http_client = __commonJS({ }; } else { const tempFile = yield tmp2.file(); - core29.debug(`${parameters.file} is greater than 64k in size. Creating a gzip file on-disk ${tempFile.path} to potentially reduce the upload size`); + core25.debug(`${parameters.file} is greater than 64k in size. Creating a gzip file on-disk ${tempFile.path} to potentially reduce the upload size`); uploadFileSize = yield (0, upload_gzip_1.createGZipFileOnDisk)(parameters.file, tempFile.path); let uploadFilePath = tempFile.path; if (!isFIFO && totalFileSize < uploadFileSize) { - core29.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); + core25.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`); uploadFileSize = totalFileSize; uploadFilePath = parameters.file; isGzip = false; } else { - core29.debug(`The gzip file created for ${parameters.file} is smaller than the original file. The file will be uploaded using gzip.`); + core25.debug(`The gzip file created for ${parameters.file} is smaller than the original file. The file will be uploaded using gzip.`); } let abortFileUpload = false; while (offset < uploadFileSize) { @@ -147542,7 +147542,7 @@ var require_upload_http_client = __commonJS({ if (!result) { isUploadSuccessful = false; failedChunkSizes += chunkSize; - core29.warning(`Aborting upload for ${parameters.file} due to failure`); + core25.warning(`Aborting upload for ${parameters.file} due to failure`); abortFileUpload = true; } else { if (uploadFileSize > 8388608) { @@ -147550,7 +147550,7 @@ var require_upload_http_client = __commonJS({ } } } - core29.debug(`deleting temporary gzip file ${tempFile.path}`); + core25.debug(`deleting temporary gzip file ${tempFile.path}`); yield tempFile.cleanup(); return { isSuccess: isUploadSuccessful, @@ -147589,7 +147589,7 @@ var require_upload_http_client = __commonJS({ if (response) { (0, utils_1.displayHttpDiagnostics)(response); } - core29.info(`Retry limit has been reached for chunk at offset ${start} to ${resourceUrl}`); + core25.info(`Retry limit has been reached for chunk at offset ${start} to ${resourceUrl}`); return true; } return false; @@ -147597,14 +147597,14 @@ var require_upload_http_client = __commonJS({ const backOff = (retryAfterValue) => __awaiter2(this, void 0, void 0, function* () { this.uploadHttpManager.disposeAndReplaceClient(httpClientIndex); if (retryAfterValue) { - core29.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the upload`); + core25.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the upload`); yield (0, utils_1.sleep)(retryAfterValue); } else { const backoffTime = (0, utils_1.getExponentialRetryTimeInMilliseconds)(retryCount); - core29.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the upload at offset ${start}`); + core25.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the upload at offset ${start}`); yield (0, utils_1.sleep)(backoffTime); } - core29.info(`Finished backoff for retry #${retryCount}, continuing with upload`); + core25.info(`Finished backoff for retry #${retryCount}, continuing with upload`); return; }); while (retryCount <= retryLimit) { @@ -147612,7 +147612,7 @@ var require_upload_http_client = __commonJS({ try { response = yield uploadChunkRequest(); } catch (error3) { - core29.info(`An error has been caught http-client index ${httpClientIndex}, retrying the upload`); + core25.info(`An error has been caught http-client index ${httpClientIndex}, retrying the upload`); console.log(error3); if (incrementAndCheckRetryLimit()) { return false; @@ -147624,13 +147624,13 @@ var require_upload_http_client = __commonJS({ if ((0, utils_1.isSuccessStatusCode)(response.message.statusCode)) { return true; } else if ((0, utils_1.isRetryableStatusCode)(response.message.statusCode)) { - core29.info(`A ${response.message.statusCode} status code has been received, will attempt to retry the upload`); + core25.info(`A ${response.message.statusCode} status code has been received, will attempt to retry the upload`); if (incrementAndCheckRetryLimit(response)) { return false; } (0, utils_1.isThrottledStatusCode)(response.message.statusCode) ? yield backOff((0, utils_1.tryGetRetryAfterValueTimeInMilliseconds)(response.message.headers)) : yield backOff(); } else { - core29.error(`Unexpected response. Unable to upload chunk to ${resourceUrl}`); + core25.error(`Unexpected response. Unable to upload chunk to ${resourceUrl}`); (0, utils_1.displayHttpDiagnostics)(response); return false; } @@ -147648,7 +147648,7 @@ var require_upload_http_client = __commonJS({ resourceUrl.searchParams.append("artifactName", artifactName); const parameters = { Size: size }; const data = JSON.stringify(parameters, null, 2); - core29.debug(`URL is ${resourceUrl.toString()}`); + core25.debug(`URL is ${resourceUrl.toString()}`); const client = this.uploadHttpManager.getClient(0); const headers = (0, utils_1.getUploadHeaders)("application/json", false); const customErrorMessages = /* @__PURE__ */ new Map([ @@ -147661,7 +147661,7 @@ var require_upload_http_client = __commonJS({ return client.patch(resourceUrl.toString(), data, headers); }), customErrorMessages); yield response.readBody(); - core29.debug(`Artifact ${artifactName} has been successfully uploaded, total size in bytes: ${size}`); + core25.debug(`Artifact ${artifactName} has been successfully uploaded, total size in bytes: ${size}`); }); } }; @@ -147730,7 +147730,7 @@ var require_download_http_client = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DownloadHttpClient = void 0; var fs32 = __importStar2(require("fs")); - var core29 = __importStar2(require_core3()); + var core25 = __importStar2(require_core3()); var zlib3 = __importStar2(require("zlib")); var utils_1 = require_utils12(); var url_1 = require("url"); @@ -147784,11 +147784,11 @@ var require_download_http_client = __commonJS({ downloadSingleArtifact(downloadItems) { return __awaiter2(this, void 0, void 0, function* () { const DOWNLOAD_CONCURRENCY = (0, config_variables_1.getDownloadFileConcurrency)(); - core29.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`); + core25.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`); const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()]; let currentFile = 0; let downloadedFiles = 0; - core29.info(`Total number of files that will be downloaded: ${downloadItems.length}`); + core25.info(`Total number of files that will be downloaded: ${downloadItems.length}`); this.statusReporter.setTotalNumberOfFilesToProcess(downloadItems.length); this.statusReporter.start(); yield Promise.all(parallelDownloads.map((index2) => __awaiter2(this, void 0, void 0, function* () { @@ -147797,8 +147797,8 @@ var require_download_http_client = __commonJS({ currentFile += 1; const startTime = perf_hooks_1.performance.now(); yield this.downloadIndividualFile(index2, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath); - if (core29.isDebug()) { - core29.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`); + if (core25.isDebug()) { + core25.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`); } this.statusReporter.incrementProcessedCount(); } @@ -147836,19 +147836,19 @@ var require_download_http_client = __commonJS({ } else { this.downloadHttpManager.disposeAndReplaceClient(httpClientIndex); if (retryAfterValue) { - core29.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`); + core25.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`); yield (0, utils_1.sleep)(retryAfterValue); } else { const backoffTime = (0, utils_1.getExponentialRetryTimeInMilliseconds)(retryCount); - core29.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`); + core25.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`); yield (0, utils_1.sleep)(backoffTime); } - core29.info(`Finished backoff for retry #${retryCount}, continuing with download`); + core25.info(`Finished backoff for retry #${retryCount}, continuing with download`); } }); const isAllBytesReceived = (expected, received) => { if (!expected || !received || process.env["ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION"]) { - core29.info("Skipping download validation."); + core25.info("Skipping download validation."); return true; } return parseInt(expected) === received; @@ -147869,7 +147869,7 @@ var require_download_http_client = __commonJS({ try { response = yield makeDownloadRequest(); } catch (error3) { - core29.info("An error occurred while attempting to download a file"); + core25.info("An error occurred while attempting to download a file"); console.log(error3); yield backOff(); continue; @@ -147889,7 +147889,7 @@ var require_download_http_client = __commonJS({ } } if (forceRetry || (0, utils_1.isRetryableStatusCode)(response.message.statusCode)) { - core29.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`); + core25.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`); resetDestinationStream(downloadPath); (0, utils_1.isThrottledStatusCode)(response.message.statusCode) ? yield backOff((0, utils_1.tryGetRetryAfterValueTimeInMilliseconds)(response.message.headers)) : yield backOff(); } else { @@ -147911,29 +147911,29 @@ var require_download_http_client = __commonJS({ if (isGzip) { const gunzip = zlib3.createGunzip(); response.message.on("error", (error3) => { - core29.info(`An error occurred while attempting to read the response stream`); + core25.info(`An error occurred while attempting to read the response stream`); gunzip.close(); destinationStream.close(); reject(error3); }).pipe(gunzip).on("error", (error3) => { - core29.info(`An error occurred while attempting to decompress the response stream`); + core25.info(`An error occurred while attempting to decompress the response stream`); destinationStream.close(); reject(error3); }).pipe(destinationStream).on("close", () => { resolve15(); }).on("error", (error3) => { - core29.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`); + core25.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`); reject(error3); }); } else { response.message.on("error", (error3) => { - core29.info(`An error occurred while attempting to read the response stream`); + core25.info(`An error occurred while attempting to read the response stream`); destinationStream.close(); reject(error3); }).pipe(destinationStream).on("close", () => { resolve15(); }).on("error", (error3) => { - core29.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`); + core25.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`); reject(error3); }); } @@ -148072,7 +148072,7 @@ var require_artifact_client = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultArtifactClient = void 0; - var core29 = __importStar2(require_core3()); + var core25 = __importStar2(require_core3()); var upload_specification_1 = require_upload_specification(); var upload_http_client_1 = require_upload_http_client(); var utils_1 = require_utils12(); @@ -148093,7 +148093,7 @@ var require_artifact_client = __commonJS({ */ uploadArtifact(name, files, rootDirectory, options) { return __awaiter2(this, void 0, void 0, function* () { - core29.info(`Starting artifact upload + core25.info(`Starting artifact upload For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`); (0, path_and_artifact_name_validation_1.checkArtifactName)(name); const uploadSpecification = (0, upload_specification_1.getUploadSpecification)(name, rootDirectory, files); @@ -148105,24 +148105,24 @@ For more detailed logs during the artifact upload process, enable step-debugging }; const uploadHttpClient = new upload_http_client_1.UploadHttpClient(); if (uploadSpecification.length === 0) { - core29.warning(`No files found that can be uploaded`); + core25.warning(`No files found that can be uploaded`); } else { const response = yield uploadHttpClient.createArtifactInFileContainer(name, options); if (!response.fileContainerResourceUrl) { - core29.debug(response.toString()); + core25.debug(response.toString()); throw new Error("No URL provided by the Artifact Service to upload an artifact to"); } - core29.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`); - core29.info(`Container for artifact "${name}" successfully created. Starting upload of file(s)`); + core25.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`); + core25.info(`Container for artifact "${name}" successfully created. Starting upload of file(s)`); const uploadResult = yield uploadHttpClient.uploadArtifactToFileContainer(response.fileContainerResourceUrl, uploadSpecification, options); - core29.info(`File upload process has finished. Finalizing the artifact upload`); + core25.info(`File upload process has finished. Finalizing the artifact upload`); yield uploadHttpClient.patchArtifactSize(uploadResult.totalSize, name); if (uploadResult.failedItems.length > 0) { - core29.info(`Upload finished. There were ${uploadResult.failedItems.length} items that failed to upload`); + core25.info(`Upload finished. There were ${uploadResult.failedItems.length} items that failed to upload`); } else { - core29.info(`Artifact has been finalized. All files have been successfully uploaded!`); + core25.info(`Artifact has been finalized. All files have been successfully uploaded!`); } - core29.info(` + core25.info(` The raw size of all the files that were specified for upload is ${uploadResult.totalSize} bytes The size of all the files that were uploaded is ${uploadResult.uploadSize} bytes. This takes into account any gzip compression used to reduce the upload size, time and storage @@ -148156,10 +148156,10 @@ Note: The size of downloaded zips can differ significantly from the reported siz path30 = (0, path_1.resolve)(path30); const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(name, items.value, path30, (options === null || options === void 0 ? void 0 : options.createArtifactFolder) || false); if (downloadSpecification.filesToDownload.length === 0) { - core29.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`); + core25.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`); } else { yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure); - core29.info("Directory structure has been set up for the artifact"); + core25.info("Directory structure has been set up for the artifact"); yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate); yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload); } @@ -148175,7 +148175,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz const response = []; const artifacts = yield downloadHttpClient.listArtifacts(); if (artifacts.count === 0) { - core29.info("Unable to find any artifacts for the associated workflow"); + core25.info("Unable to find any artifacts for the associated workflow"); return response; } if (!path30) { @@ -148187,11 +148187,11 @@ Note: The size of downloaded zips can differ significantly from the reported siz while (downloadedArtifacts < artifacts.count) { const currentArtifactToDownload = artifacts.value[downloadedArtifacts]; downloadedArtifacts += 1; - core29.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`); + core25.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`); const items = yield downloadHttpClient.getContainerItems(currentArtifactToDownload.name, currentArtifactToDownload.fileContainerResourceUrl); const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(currentArtifactToDownload.name, items.value, path30, true); if (downloadSpecification.filesToDownload.length === 0) { - core29.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`); + core25.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`); } else { yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure); yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate); @@ -180285,9 +180285,9 @@ function validateSarifFileSchema(sarifLog, sarifFilePath, logger2) { const warnings = (result.errors ?? []).filter( (err) => err.name === "format" && typeof err.argument === "string" && warningAttributes.includes(err.argument) ); - for (const warning14 of warnings) { + for (const warning13 of warnings) { logger2.info( - `Warning: '${warning14.instance}' is not a valid URI in '${warning14.property}'.` + `Warning: '${warning13.instance}' is not a valid URI in '${warning13.property}'.` ); } if (errors.length > 0) { @@ -181020,7 +181020,6 @@ async function runWrapper() { // src/analyze-action-post.ts var fs27 = __toESM(require("fs")); -var core16 = __toESM(require_core()); // src/debug-artifacts.ts var fs26 = __toESM(require("fs")); @@ -185919,7 +185918,7 @@ async function run2(action) { try { const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); - if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] === "true") { + if (action.env.getOptional("CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */) === "true") { const config = await getConfig( getTemporaryDirectory(), logger2 @@ -185947,7 +185946,7 @@ async function run2(action) { } } } catch (error3) { - core16.setFailed( + action.actions.setFailed( `analyze post-action step failed: ${getErrorMessage(error3)}` ); } @@ -185961,7 +185960,7 @@ async function runWrapper2() { } // src/autobuild-action.ts -var core17 = __toESM(require_core()); +var core16 = __toESM(require_core()); async function sendCompletedStatusReport(config, logger2, startedAt, allLanguages, failingLanguage, cause) { initializeEnvironment(getActionVersion()); const status = getActionsStatus(cause, failingLanguage); @@ -186031,7 +186030,7 @@ async function run3({ await endTracingForCluster(codeql, config, logger2); } catch (unwrappedError) { const error3 = wrapError(unwrappedError); - core17.setFailed( + core16.setFailed( `We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error3.message}` ); await sendCompletedStatusReport( @@ -186058,7 +186057,7 @@ async function runWrapper3() { // src/init-action.ts var fs29 = __toESM(require("fs")); var path25 = __toESM(require("path")); -var core19 = __toESM(require_core()); +var core18 = __toESM(require_core()); var io7 = __toESM(require_io()); var semver10 = __toESM(require_semver2()); @@ -186118,7 +186117,7 @@ function createInitToolsDownloadFields(report, toolsFeatureFlagsValid) { var fs28 = __toESM(require("fs")); var path24 = __toESM(require("path")); var import_zlib3 = __toESM(require("zlib")); -var core18 = __toESM(require_core()); +var core17 = __toESM(require_core()); function toCodedErrors(errors) { return Object.entries(errors).reduce( (acc, [code, message]) => { @@ -186241,7 +186240,7 @@ async function validateWorkflow(codeql, logger2) { } catch (e) { return `error: formatWorkflowErrors() failed: ${String(e)}`; } - core18.warning(message); + core17.warning(message); } return formatWorkflowCause(workflowErrors); } @@ -186376,7 +186375,7 @@ function getRepositoryRootOrThrow(workflow, jobName, matrixVars, config, env = g } async function checkWorkflow(logger2, codeql) { if (!isDynamicWorkflow() && process.env["CODEQL_ACTION_SKIP_WORKFLOW_VALIDATION" /* SKIP_WORKFLOW_VALIDATION */] !== "true") { - core18.startGroup("Validating workflow"); + core17.startGroup("Validating workflow"); const validateWorkflowResult = await internal2.validateWorkflow( codeql, logger2 @@ -186388,7 +186387,7 @@ async function checkWorkflow(logger2, codeql) { `Unable to validate code scanning workflow: ${validateWorkflowResult}` ); } - core18.endGroup(); + core17.endGroup(); } } var internal2 = { @@ -186576,7 +186575,7 @@ async function run4(actionState) { } } analysisKinds = await getAnalysisKinds(logger2, features); - const debugMode = getOptionalInput("debug") === "true" || core19.isDebug(); + const debugMode = getOptionalInput("debug") === "true" || core18.isDebug(); const fileCoverageResult = await getFileCoverageInformationEnabled( debugMode, codeql, @@ -186657,7 +186656,7 @@ async function run4(actionState) { } } const error3 = wrapError(unwrappedError); - core19.setFailed(error3.message); + core18.setFailed(error3.message); const statusReportBase = await createStatusReportBase( "init" /* Init */, error3 instanceof ConfigurationError ? "user-error" : "aborted", @@ -186700,7 +186699,7 @@ async function run4(actionState) { const goFlags = actionState.env.getOptional("GOFLAGS"); if (goFlags) { actionState.env.export("GOFLAGS", goFlags); - core19.warning( + core18.warning( "Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action." ); } @@ -186719,7 +186718,7 @@ async function run4(actionState) { "bin" ); fs29.mkdirSync(tempBinPath, { recursive: true }); - core19.addPath(tempBinPath); + core18.addPath(tempBinPath); const goWrapperPath = path25.resolve(tempBinPath, "go"); fs29.writeFileSync( goWrapperPath, @@ -186858,11 +186857,11 @@ exec ${goBinaryPath} "$@"` } flushDiagnostics(config); await saveConfig(config, logger2); - core19.setOutput("codeql-path", config.codeQLCmd); - core19.setOutput("codeql-version", (await codeql.getVersion()).version); + core18.setOutput("codeql-path", config.codeQLCmd); + core18.setOutput("codeql-version", (await codeql.getVersion()).version); } catch (unwrappedError) { const error3 = wrapError(unwrappedError); - core19.setFailed(error3.message); + core18.setFailed(error3.message); await sendCompletedStatusReport2( startedAt, config, @@ -186905,9 +186904,6 @@ async function runWrapper4() { await checkForTimeout(); } -// src/init-action-post.ts -var core20 = __toESM(require_core()); - // src/init-action-post-helper.ts var fs30 = __toESM(require("fs")); var import_path8 = __toESM(require("path")); @@ -187251,7 +187247,7 @@ async function run5(action) { let uploadFailedSarifResult; let dependencyCachingUsage; try { - const jobStatus2 = getOptionalInput("job-status"); + const jobStatus2 = action.actions.getOptionalInput("job-status"); const tmpDir = getTemporaryDirectory(); config = await getConfig(tmpDir, logger2); if (config === void 0) { @@ -187263,7 +187259,7 @@ async function run5(action) { const features = initFeatures( gitHubVersion, repositoryNwo, - getTemporaryDirectory(), + config?.tempDir ?? tmpDir, logger2 ); if (config === void 0) { @@ -187292,7 +187288,7 @@ async function run5(action) { } } catch (unwrappedError) { const error3 = wrapApiConfigurationError(wrapError(unwrappedError)); - core20.setFailed(error3.message); + action.actions.setFailed(error3.message); const statusReportBase2 = await createStatusReportBase( action.name, getActionsStatus(error3), @@ -187366,7 +187362,7 @@ async function runWrapper5() { } // src/resolve-environment-action.ts -var core21 = __toESM(require_core()); +var core19 = __toESM(require_core()); // src/resolve-environment.ts async function runResolveBuildEnvironment(cmd, logger2, workingDir, language) { @@ -187413,16 +187409,16 @@ async function run6(startedAt) { workingDirectory, getRequiredInput("language") ); - core21.setOutput(ENVIRONMENT_OUTPUT_NAME, result); + core19.setOutput(ENVIRONMENT_OUTPUT_NAME, result); } catch (unwrappedError) { const error3 = wrapError(unwrappedError); if (error3 instanceof CliError) { - core21.setOutput(ENVIRONMENT_OUTPUT_NAME, {}); + core19.setOutput(ENVIRONMENT_OUTPUT_NAME, {}); logger2.warning( `Failed to resolve a build environment suitable for automatically building your code. ${error3.message}` ); } else { - core21.setFailed( + core19.setFailed( `Failed to resolve a build environment suitable for automatically building your code. ${error3.message}` ); const statusReportBase2 = await createStatusReportBase( @@ -187459,7 +187455,7 @@ async function runWrapper6() { try { await run6(startedAt); } catch (error3) { - core21.setFailed( + core19.setFailed( `${"resolve-environment" /* ResolveEnvironment */} action failed: ${getErrorMessage( error3 )}` @@ -187475,7 +187471,7 @@ async function runWrapper6() { } // src/setup-codeql-action.ts -var core22 = __toESM(require_core()); +var core20 = __toESM(require_core()); async function sendCompletedStatusReport3(startedAt, toolsInput, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger2, error3) { const statusReportBase = await createStatusReportBase( "setup-codeql" /* SetupCodeQL */, @@ -187580,12 +187576,12 @@ async function run7(actionState) { toolsDownloadStatusReport = initCodeQLResult.toolsDownloadStatusReport; toolsVersion = initCodeQLResult.toolsVersion; toolsSource = initCodeQLResult.toolsSource; - core22.setOutput("codeql-path", codeql.getPath()); - core22.setOutput("codeql-version", (await codeql.getVersion()).version); + core20.setOutput("codeql-path", codeql.getPath()); + core20.setOutput("codeql-version", (await codeql.getVersion()).version); actionState.env.export("CODEQL_ACTION_SETUP_CODEQL_HAS_RUN" /* SETUP_CODEQL_ACTION_HAS_RUN */, "true"); } catch (unwrappedError) { const error3 = wrapError(unwrappedError); - core22.setFailed(error3.message); + core20.setFailed(error3.message); const statusReportBase = await createStatusReportBase( "setup-codeql" /* SetupCodeQL */, error3 instanceof ConfigurationError ? "user-error" : "failure", @@ -187623,14 +187619,14 @@ async function runWrapper7() { // src/start-proxy-action.ts var import_child_process2 = require("child_process"); var path29 = __toESM(require("path")); -var core25 = __toESM(require_core()); +var core23 = __toESM(require_core()); // src/start-proxy.ts var path27 = __toESM(require("path")); var toolcache4 = __toESM(require_tool_cache()); // src/start-proxy/status-report.ts -var core23 = __toESM(require_core()); +var core21 = __toESM(require_core()); async function sendSuccessStatusReport(startedAt, config, registry_types, status, logger2) { const statusReportBase = await createStatusReportBase( "start-proxy" /* StartProxy */, @@ -187674,7 +187670,7 @@ function getSafeErrorMessage(error3) { } async function sendFailedStatusReport(logger2, startedAt, language, unwrappedError) { const error3 = wrapError(unwrappedError); - core23.setFailed(`start-proxy action failed: ${error3.message}`); + core21.setFailed(`start-proxy action failed: ${error3.message}`); const statusReportMessage = getSafeErrorMessage(error3); const errorStatusReportBase = await createStatusReportBase( "start-proxy" /* StartProxy */, @@ -187693,7 +187689,7 @@ async function sendFailedStatusReport(logger2, startedAt, language, unwrappedErr } // src/start-proxy/validation.ts -var core24 = __toESM(require_core()); +var core22 = __toESM(require_core()); function cloneCredential(schema, obj) { const result = {}; for (const key of Object.keys(schema)) { @@ -187712,14 +187708,14 @@ function getAuthConfig(config) { } if (isToken(config)) { if (isDefined2(config.token)) { - core24.setSecret(config.token); + core22.setSecret(config.token); } return cloneCredential(tokenSchema, config); } else { let username = void 0; let password = void 0; if ("password" in config && isString(config.password)) { - core24.setSecret(config.password); + core22.setSecret(config.password); password = config.password; } if ("username" in config && isString(config.username)) { @@ -188292,7 +188288,7 @@ async function run8(action) { persistInputs(); const tempDir = getTemporaryDirectory(); const proxyLogFilePath = path29.resolve(tempDir, "proxy.log"); - core25.saveState("proxy-log-file", proxyLogFilePath); + core23.saveState("proxy-log-file", proxyLogFilePath); const repositoryNwo = getRepositoryNwo(); const gitHubVersion = await getGitHubVersion(); features = initFeatures( @@ -188317,7 +188313,7 @@ async function run8(action) { `Credentials loaded for the following registries: ${credentials.map((c) => credentialToStr(c)).join("\n")}` ); - if (core25.isDebug() || isInTestMode()) { + if (core23.isDebug() || isInTestMode()) { try { await checkProxyEnvironment(logger2, language); } catch (err) { @@ -188381,7 +188377,7 @@ async function startProxy(binPath, config, logFilePath, logger2) { ); subprocess.unref(); if (subprocess.pid) { - core25.saveState("proxy-process-pid", `${subprocess.pid}`); + core23.saveState("proxy-process-pid", `${subprocess.pid}`); } subprocess.on("error", (error3) => { subprocessError = error3; @@ -188400,33 +188396,30 @@ async function startProxy(binPath, config, logFilePath, logger2) { throw subprocessError; } logger2.info(`Proxy started on ${host}:${port}`); - core25.setOutput("proxy_host", host); - core25.setOutput("proxy_port", port.toString()); - core25.setOutput("proxy_ca_certificate", config.ca.cert); + core23.setOutput("proxy_host", host); + core23.setOutput("proxy_port", port.toString()); + core23.setOutput("proxy_ca_certificate", config.ca.cert); const registry_urls = config.all_credentials.filter((credential) => credential.url !== void 0).map((credential) => ({ type: credential.type, url: credential.url, "replaces-base": credential["replaces-base"] })); - core25.setOutput("proxy_urls", JSON.stringify(registry_urls)); + core23.setOutput("proxy_urls", JSON.stringify(registry_urls)); return { host, port, cert: config.ca.cert, registries: registry_urls }; } // src/start-proxy-action-post.ts -var core26 = __toESM(require_core()); async function run9(action) { const logger2 = action.logger; try { - const pid = core26.getState("proxy-process-pid"); + const pid = action.actions.getState("proxy-process-pid"); if (pid) { process.kill(Number(pid)); } - const config = await getConfig( - getTemporaryDirectory(), - logger2 - ); - if (config?.debugMode || core26.isDebug()) { - const logFilePath = core26.getState("proxy-log-file"); + const tempDir = getTemporaryDirectory(); + const config = await getConfig(tempDir, logger2); + if (config?.debugMode || logger2.isDebug()) { + const logFilePath = action.actions.getState("proxy-log-file"); logger2.info( "Debug mode is on. Uploading proxy log as Actions debugging artifact..." ); @@ -188435,7 +188428,7 @@ async function run9(action) { await uploadArtifacts( logger2, [logFilePath], - getTemporaryDirectory(), + tempDir, "proxy-log-file", gitHubVersion.type ); @@ -188456,7 +188449,7 @@ async function runWrapper9() { } // src/upload-sarif-action.ts -var core27 = __toESM(require_core()); +var core24 = __toESM(require_core()); async function sendSuccessStatusReport2(startedAt, uploadStats, logger2) { const statusReportBase = await createStatusReportBase( "upload-sarif" /* UploadSarif */, @@ -188516,11 +188509,11 @@ async function run10({ startedAt, logger: logger2 }) { } const codeScanningResult = uploadResults["code-scanning" /* CodeScanning */]; if (codeScanningResult !== void 0) { - core27.setOutput("sarif-id", codeScanningResult.sarifID); + core24.setOutput("sarif-id", codeScanningResult.sarifID); } - core27.setOutput("sarif-ids", JSON.stringify(uploadResults)); + core24.setOutput("sarif-ids", JSON.stringify(uploadResults)); if (shouldSkipSarifUpload()) { - core27.debug( + core24.debug( "SARIF upload disabled by an environment variable. Waiting for processing is disabled." ); } else if (getRequiredInput("wait-for-processing") === "true") { @@ -188540,7 +188533,7 @@ async function run10({ startedAt, logger: logger2 }) { } catch (unwrappedError) { const error3 = isThirdPartyAnalysis("upload-sarif" /* UploadSarif */) && unwrappedError instanceof InvalidSarifUploadError ? new ConfigurationError(unwrappedError.message) : wrapError(unwrappedError); const message = error3.message; - core27.setFailed(message); + core24.setFailed(message); const errorStatusReportBase = await createStatusReportBase( "upload-sarif" /* UploadSarif */, getActionsStatus(error3), @@ -188566,15 +188559,14 @@ async function runWrapper10() { } // src/upload-sarif-action-post.ts -var core28 = __toESM(require_core()); async function run11(action) { const logger2 = action.logger; try { const gitHubVersion = await getGitHubVersion(); checkGitHubVersionInRange(gitHubVersion, logger2); - if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] !== "true") { + if (action.env.getOptional("CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */) !== "true") { if (gitHubVersion.type === void 0) { - core28.warning( + logger2.warning( `Did not upload debug artifacts because cannot determine the GitHub variant running.` ); return; @@ -188585,7 +188577,7 @@ async function run11(action) { ); } } catch (error3) { - core28.setFailed( + action.actions.setFailed( `upload-sarif post-action step failed: ${getErrorMessage(error3)}` ); } diff --git a/src/analyze-action-post.ts b/src/analyze-action-post.ts index 46f8bbf0e8..4b1b77da51 100644 --- a/src/analyze-action-post.ts +++ b/src/analyze-action-post.ts @@ -5,8 +5,6 @@ */ import * as fs from "fs"; -import * as core from "@actions/core"; - import { ActionName, runInActions, @@ -28,7 +26,7 @@ import { checkGitHubVersionInRange, getErrorMessage } from "./util"; * The main functionality of the `analyze` post-action is implemented by this function. * This is called once by {@link runInActions} after it is called in {@link runWrapper}. */ -export async function run(action: ActionState<["Logger"]>) { +export async function run(action: ActionState<["Logger", "Env", "Actions"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. const logger = action.logger; @@ -39,7 +37,7 @@ export async function run(action: ActionState<["Logger"]>) { // Upload SARIF artifacts if we determine that this is a first-party analysis run. // For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step. - if (process.env[EnvVar.INIT_ACTION_HAS_RUN] === "true") { + if (action.env.getOptional(EnvVar.INIT_ACTION_HAS_RUN) === "true") { const config = await getConfig( actionsUtil.getTemporaryDirectory(), logger, @@ -71,7 +69,7 @@ export async function run(action: ActionState<["Logger"]>) { } } } catch (error) { - core.setFailed( + action.actions.setFailed( `analyze post-action step failed: ${getErrorMessage(error)}`, ); } diff --git a/src/init-action-post.ts b/src/init-action-post.ts index ba3c6d0d81..55dc38e7d5 100644 --- a/src/init-action-post.ts +++ b/src/init-action-post.ts @@ -4,14 +4,8 @@ * other `post:` hooks. */ -import * as core from "@actions/core"; - import { runInActions, type Action, type ActionState } from "./action-common"; -import { - getOptionalInput, - getTemporaryDirectory, - printDebugLogs, -} from "./actions-util"; +import { getTemporaryDirectory, printDebugLogs } from "./actions-util"; import { getGitHubVersion, wrapApiConfigurationError } from "./api-client"; import { CachingKind } from "./caching-utils"; import { getCodeQL } from "./codeql"; @@ -48,7 +42,11 @@ interface InitPostStatusReport initActionPostHelper.JobStatusReport, initActionPostHelper.DependencyCachingUsageReport {} -async function run(action: ActionState<["Base", "Logger", "Env"]>) { +/** + * The main functionality of the `init` post-action is implemented by this function. + * This is called once by {@link runInActions} after it is called in {@link runWrapper}. + */ +async function run(action: ActionState<["Base", "Logger", "Env", "Actions"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. const logger = action.logger; @@ -63,7 +61,7 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) { // Read the job status before restoring inputs, since it is provided by the Actions runtime // environment for this step and would otherwise be overwritten by the value that the `init` // Action saw, which is always a success. - const jobStatus = getOptionalInput("job-status"); + const jobStatus = action.actions.getOptionalInput("job-status"); const tmpDir = getTemporaryDirectory(); config = await getConfig(tmpDir, logger); @@ -82,7 +80,7 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) { const features = initFeatures( gitHubVersion, repositoryNwo, - getTemporaryDirectory(), + config?.tempDir ?? tmpDir, logger, ); @@ -122,7 +120,7 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) { } } catch (unwrappedError) { const error = wrapApiConfigurationError(wrapError(unwrappedError)); - core.setFailed(error.message); + action.actions.setFailed(error.message); const statusReportBase = await createStatusReportBase( action.name, diff --git a/src/start-proxy-action-post.ts b/src/start-proxy-action-post.ts index a9ead650ee..e4115bd6bb 100644 --- a/src/start-proxy-action-post.ts +++ b/src/start-proxy-action-post.ts @@ -3,8 +3,6 @@ * It will run after the all steps in this job, in reverse order in relation to * other `post:` hooks. */ -import * as core from "@actions/core"; - import { ActionName, runInActions, @@ -22,7 +20,7 @@ import { checkGitHubVersionInRange, getErrorMessage } from "./util"; * The main functionality of the `start-proxy` post-action is implemented by this function. * This is called once by {@link runInActions} after it is called in {@link runWrapper}. */ -export async function run(action: ActionState<["Logger"]>) { +export async function run(action: ActionState<["Logger", "Actions"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. @@ -30,18 +28,16 @@ export async function run(action: ActionState<["Logger"]>) { try { // Kill the running proxy - const pid = core.getState("proxy-process-pid"); + const pid = action.actions.getState("proxy-process-pid"); if (pid) { process.kill(Number(pid)); } - const config = await configUtils.getConfig( - actionsUtil.getTemporaryDirectory(), - logger, - ); + const tempDir = actionsUtil.getTemporaryDirectory(); + const config = await configUtils.getConfig(tempDir, logger); - if (config?.debugMode || core.isDebug()) { - const logFilePath = core.getState("proxy-log-file"); + if (config?.debugMode || logger.isDebug()) { + const logFilePath = action.actions.getState("proxy-log-file"); logger.info( "Debug mode is on. Uploading proxy log as Actions debugging artifact...", ); @@ -51,7 +47,7 @@ export async function run(action: ActionState<["Logger"]>) { await uploadArtifacts( logger, [logFilePath], - actionsUtil.getTemporaryDirectory(), + tempDir, "proxy-log-file", gitHubVersion.type, ); diff --git a/src/upload-sarif-action-post.ts b/src/upload-sarif-action-post.ts index 265917e367..a31ad2b169 100644 --- a/src/upload-sarif-action-post.ts +++ b/src/upload-sarif-action-post.ts @@ -3,8 +3,6 @@ * It will run after the all steps in this job, in reverse order in relation to * other `post:` hooks. */ -import * as core from "@actions/core"; - import { ActionName, runInActions, @@ -21,7 +19,7 @@ import { checkGitHubVersionInRange, getErrorMessage } from "./util"; * The main functionality of the `upload-sarif` post-action is implemented by this function. * This is called once by {@link runInActions} after it is called in {@link runWrapper}. */ -export async function run(action: ActionState<["Logger"]>) { +export async function run(action: ActionState<["Logger", "Env", "Actions"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. const logger = action.logger; @@ -32,9 +30,9 @@ export async function run(action: ActionState<["Logger"]>) { // Upload SARIF artifacts if we determine that this is a third-party analysis run. // For first-party runs, this artifact will be uploaded in the `analyze-post` step. - if (process.env[EnvVar.INIT_ACTION_HAS_RUN] !== "true") { + if (action.env.getOptional(EnvVar.INIT_ACTION_HAS_RUN) !== "true") { if (gitHubVersion.type === undefined) { - core.warning( + logger.warning( `Did not upload debug artifacts because cannot determine the GitHub variant running.`, ); return; @@ -44,7 +42,7 @@ export async function run(action: ActionState<["Logger"]>) { ); } } catch (error) { - core.setFailed( + action.actions.setFailed( `upload-sarif post-action step failed: ${getErrorMessage(error)}`, ); } From 7a6a2ca1d19eaea5666648de76302120a0f3b887 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 20:27:19 +0100 Subject: [PATCH 10/10] Use `runInActions` for the `resolve-environment` action --- lib/entry-points.js | 52 ++++++++++--------------- src/resolve-environment-action.ts | 63 +++++++++++++------------------ 2 files changed, 46 insertions(+), 69 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index b53ad2c522..d3f50711e2 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -21649,7 +21649,7 @@ var require_core = __commonJS({ exports2.getBooleanInput = getBooleanInput; exports2.setOutput = setOutput7; exports2.setCommandEcho = setCommandEcho; - exports2.setFailed = setFailed10; + exports2.setFailed = setFailed9; exports2.isDebug = isDebug4; exports2.debug = debug6; exports2.error = error3; @@ -21733,7 +21733,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); function setCommandEcho(enabled) { (0, command_1.issue)("echo", enabled ? "on" : "off"); } - function setFailed10(message) { + function setFailed9(message) { process.exitCode = ExitCode.Failure; error3(message); } @@ -145643,11 +145643,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issue)("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; - function setFailed10(message) { + function setFailed9(message) { process.exitCode = ExitCode.Failure; error3(message); } - exports2.setFailed = setFailed10; + exports2.setFailed = setFailed9; function isDebug4() { return process.env["RUNNER_DEBUG"] === "1"; } @@ -187378,14 +187378,14 @@ async function runResolveBuildEnvironment(cmd, logger2, workingDir, language) { // src/resolve-environment-action.ts var ENVIRONMENT_OUTPUT_NAME = "environment"; -async function run6(startedAt) { - const logger2 = getActionsLogger(); +async function run6(action) { + const logger2 = action.logger; let config; try { const statusReportBase2 = await createStatusReportBase( - "resolve-environment" /* ResolveEnvironment */, + action.name, "starting", - startedAt, + action.startedAt, config, await checkDiskUsage(logger2), logger2 @@ -187402,12 +187402,12 @@ async function run6(startedAt) { "Config file could not be found at expected location. Has the 'init' action been called?" ); } - const workingDirectory = getOptionalInput("working-directory"); + const workingDirectory = action.actions.getOptionalInput("working-directory"); const result = await runResolveBuildEnvironment( config.codeQLCmd, logger2, workingDirectory, - getRequiredInput("language") + action.actions.getRequiredInput("language") ); core19.setOutput(ENVIRONMENT_OUTPUT_NAME, result); } catch (unwrappedError) { @@ -187418,13 +187418,13 @@ async function run6(startedAt) { `Failed to resolve a build environment suitable for automatically building your code. ${error3.message}` ); } else { - core19.setFailed( + action.actions.setFailed( `Failed to resolve a build environment suitable for automatically building your code. ${error3.message}` ); const statusReportBase2 = await createStatusReportBase( - "resolve-environment" /* ResolveEnvironment */, + action.name, getActionsStatus(error3), - startedAt, + action.startedAt, config, await checkDiskUsage(logger2), logger2, @@ -187438,9 +187438,9 @@ async function run6(startedAt) { return; } const statusReportBase = await createStatusReportBase( - "resolve-environment" /* ResolveEnvironment */, + action.name, "success", - startedAt, + action.startedAt, config, await checkDiskUsage(logger2), logger2 @@ -187449,24 +187449,12 @@ async function run6(startedAt) { await sendStatusReport(statusReportBase); } } +var resolveEnvironmentAction = { + name: "resolve-environment" /* ResolveEnvironment */, + run: run6 +}; async function runWrapper6() { - const startedAt = /* @__PURE__ */ new Date(); - const logger2 = getActionsLogger(); - try { - await run6(startedAt); - } catch (error3) { - core19.setFailed( - `${"resolve-environment" /* ResolveEnvironment */} action failed: ${getErrorMessage( - error3 - )}` - ); - await sendUnhandledErrorStatusReport( - "resolve-environment" /* ResolveEnvironment */, - startedAt, - error3, - logger2 - ); - } + await runInActions(resolveEnvironmentAction); await checkForTimeout(); } diff --git a/src/resolve-environment-action.ts b/src/resolve-environment-action.ts index 1f2c6f36b0..b9c0fc8507 100644 --- a/src/resolve-environment-action.ts +++ b/src/resolve-environment-action.ts @@ -1,19 +1,13 @@ import * as core from "@actions/core"; -import { - getActionVersion, - getOptionalInput, - getRequiredInput, - getTemporaryDirectory, -} from "./actions-util"; +import { runInActions, type Action, type ActionState } from "./action-common"; +import { getActionVersion, getTemporaryDirectory } from "./actions-util"; import { getGitHubVersion } from "./api-client"; import { CliError } from "./cli-errors"; import { Config, getConfig } from "./config-utils"; -import { getActionsLogger } from "./logging"; import { runResolveBuildEnvironment } from "./resolve-environment"; import { sendStatusReport, - sendUnhandledErrorStatusReport, createStatusReportBase, getActionsStatus, ActionName, @@ -24,25 +18,28 @@ import { checkForTimeout, checkGitHubVersionInRange, ConfigurationError, - getErrorMessage, wrapError, } from "./util"; const ENVIRONMENT_OUTPUT_NAME = "environment"; -async function run(startedAt: Date) { +/** + * The main functionality of the `resolve-environment` action is implemented by this function. + * This is called once by {@link runInActions} after it is called in {@link runWrapper}. + */ +async function run(action: ActionState<["Base", "Logger", "Actions"]>) { // To capture errors appropriately, keep as much code within the try-catch as // possible, and only use safe functions outside. - const logger = getActionsLogger(); + const logger = action.logger; let config: Config | undefined; try { const statusReportBase = await createStatusReportBase( - ActionName.ResolveEnvironment, + action.name, "starting", - startedAt, + action.startedAt, config, await checkDiskUsage(logger), logger, @@ -62,12 +59,13 @@ async function run(startedAt: Date) { ); } - const workingDirectory = getOptionalInput("working-directory"); + const workingDirectory = + action.actions.getOptionalInput("working-directory"); const result = await runResolveBuildEnvironment( config.codeQLCmd, logger, workingDirectory, - getRequiredInput("language"), + action.actions.getRequiredInput("language"), ); core.setOutput(ENVIRONMENT_OUTPUT_NAME, result); } catch (unwrappedError) { @@ -82,14 +80,14 @@ async function run(startedAt: Date) { ); } else { // For any other error types, something has more seriously gone wrong and we fail. - core.setFailed( + action.actions.setFailed( `Failed to resolve a build environment suitable for automatically building your code. ${error.message}`, ); const statusReportBase = await createStatusReportBase( - ActionName.ResolveEnvironment, + action.name, getActionsStatus(error), - startedAt, + action.startedAt, config, await checkDiskUsage(logger), logger, @@ -105,9 +103,9 @@ async function run(startedAt: Date) { } const statusReportBase = await createStatusReportBase( - ActionName.ResolveEnvironment, + action.name, "success", - startedAt, + action.startedAt, config, await checkDiskUsage(logger), logger, @@ -117,23 +115,14 @@ async function run(startedAt: Date) { } } +/** Defines the `resolve-environment` action. */ +const resolveEnvironmentAction: Action = { + name: ActionName.ResolveEnvironment, + run, +}; + +/** The main entry point for the `resolve-environment` action. */ export async function runWrapper() { - const startedAt = new Date(); - const logger = getActionsLogger(); - try { - await run(startedAt); - } catch (error) { - core.setFailed( - `${ActionName.ResolveEnvironment} action failed: ${getErrorMessage( - error, - )}`, - ); - await sendUnhandledErrorStatusReport( - ActionName.ResolveEnvironment, - startedAt, - error, - logger, - ); - } + await runInActions(resolveEnvironmentAction); await checkForTimeout(); }