From f4e96ed27f5783ccdcc7357c0105639da332f267 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 19 Oct 2026 19:44:39 +0100 Subject: [PATCH] Restore inputs in `runInActions` --- lib/entry-points.js | 10 ++++++---- src/action-common.ts | 8 +++++++- src/analyze-action-post.ts | 1 - src/init-action-post.ts | 4 ---- src/start-proxy-action-post.ts | 3 --- src/status-report.ts | 5 +++++ src/upload-sarif-action-post.ts | 3 --- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 25bb07ddc..8a3c7cb32 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -171436,6 +171436,9 @@ var ACTION_DISPLAY_NAMES = { ["start-proxy-post" /* StartProxyPost */]: "start-proxy post-action", ["upload-sarif-post" /* UploadSarifPost */]: "upload-sarif post-action" }; +function isPostAction(name) { + return name.endsWith("-post"); +} function getDisplayActionName(actionName) { const displayName = ACTION_DISPLAY_NAMES[actionName]; return displayName ?? actionName; @@ -171777,6 +171780,9 @@ async function runInActions(action) { env, actions: actionsEnv }; + if (isPostAction(action.name)) { + restoreInputs(logger2); + } getJobUUID(actionState); await action.run(actionState); } catch (error3) { @@ -185917,7 +185923,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") { @@ -187263,7 +187268,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) { @@ -188432,7 +188436,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)); @@ -188589,7 +188592,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 360cb2bbb..908cb3c63 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"; @@ -9,6 +9,7 @@ import { ActionName, getDisplayActionName, getJobUUID, + isPostAction, sendUnhandledErrorStatusReport, } from "./status-report"; import { getEnv, getErrorMessage, wrapError } from "./util"; @@ -180,6 +181,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 2c284554c..46f8bbf0e 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 071137f54..4d933b508 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 0b10afcbe..a9ead650e 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/status-report.ts b/src/status-report.ts index b23205671..7b13269ed 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -73,6 +73,11 @@ export const ACTION_DISPLAY_NAMES: Partial> = { [ActionName.UploadSarifPost]: "upload-sarif post-action", }; +/** Decides if {@link name} refers to a post-action. */ +export function isPostAction(name: ActionName) { + return name.endsWith("-post"); +} + /** * Maps an {@link ActionName} to its display name. Usually that is the same, except * for actions which have a different display name in {@link ACTION_DISPLAY_NAMES}. diff --git a/src/upload-sarif-action-post.ts b/src/upload-sarif-action-post.ts index 5e2ce338e..265917e36 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);