Skip to content

Commit 9d9422a

Browse files
committed
Restore inputs in runInActions
1 parent 2a0f9f0 commit 9d9422a

6 files changed

Lines changed: 32 additions & 16 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/action-common.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as core from "@actions/core";
22

3-
import { ActionsEnv, getActionsEnv } from "./actions-util";
3+
import { ActionsEnv, getActionsEnv, restoreInputs } from "./actions-util";
44
import type { ApiClient } from "./api-client";
55
import { Env, ReadOnlyEnv } from "./environment";
66
import type { FeatureEnablement } from "./feature-flags";
@@ -162,6 +162,19 @@ export interface Action {
162162
transformTelemetryError?: (error: Error) => string;
163163
}
164164

165+
/** Decides if {@link name} refers to a post-action. */
166+
function isPostAction(name: ActionName) {
167+
switch (name) {
168+
case ActionName.AnalyzePost:
169+
case ActionName.InitPost:
170+
case ActionName.StartProxyPost:
171+
case ActionName.UploadSarifPost:
172+
return true;
173+
}
174+
175+
return false;
176+
}
177+
165178
/** A generic entry point that sets up the basic environment for the `action` and runs it. */
166179
export async function runInActions(action: Action) {
167180
const startedAt = new Date();
@@ -180,6 +193,11 @@ export async function runInActions(action: Action) {
180193
actions: actionsEnv,
181194
};
182195

196+
// If this is a post-action, restore inputs from the main action.
197+
if (isPostAction(action.name)) {
198+
restoreInputs(logger);
199+
}
200+
183201
// Create a unique identifier for this run.
184202
getJobUUID(actionState);
185203

‎src/analyze-action-post.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export async function run(action: ActionState<["Logger"]>) {
3434
const logger = action.logger;
3535

3636
try {
37-
actionsUtil.restoreInputs(logger);
3837
const gitHubVersion = await getGitHubVersion();
3938
checkGitHubVersionInRange(gitHubVersion, logger);
4039

‎src/init-action-post.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as core from "@actions/core";
88

99
import { runInActions, type Action, type ActionState } from "./action-common";
1010
import {
11-
restoreInputs,
1211
getOptionalInput,
1312
getTemporaryDirectory,
1413
printDebugLogs,
@@ -66,9 +65,6 @@ async function run(action: ActionState<["Base", "Logger", "Env"]>) {
6665
// Action saw, which is always a success.
6766
const jobStatus = getOptionalInput("job-status");
6867

69-
// Restore inputs from `init` Action.
70-
restoreInputs(logger);
71-
7268
const tmpDir = getTemporaryDirectory();
7369
config = await getConfig(tmpDir, logger);
7470

‎src/start-proxy-action-post.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ export async function run(action: ActionState<["Logger"]>) {
2929
const logger = action.logger;
3030

3131
try {
32-
// Restore inputs from `start-proxy` Action.
33-
actionsUtil.restoreInputs(logger);
34-
3532
// Kill the running proxy
3633
const pid = core.getState("proxy-process-pid");
3734
if (pid) {

‎src/upload-sarif-action-post.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
type Action,
1212
type ActionState,
1313
} from "./action-common";
14-
import * as actionsUtil from "./actions-util";
1514
import { getGitHubVersion } from "./api-client";
1615
import * as debugArtifacts from "./debug-artifacts";
1716
import { EnvVar } from "./environment";
@@ -28,8 +27,6 @@ export async function run(action: ActionState<["Logger"]>) {
2827
const logger = action.logger;
2928

3029
try {
31-
// Restore inputs from `upload-sarif` Action.
32-
actionsUtil.restoreInputs(logger);
3330
const gitHubVersion = await getGitHubVersion();
3431
checkGitHubVersionInRange(gitHubVersion, logger);
3532

0 commit comments

Comments
 (0)