mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Restore inputs in runInActions
This commit is contained in:
17
lib/entry-points.js
generated
17
lib/entry-points.js
generated
@@ -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") {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user