mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Log error in restoreInputs instead of re-throwing it
This commit is contained in:
17
lib/entry-points.js
generated
17
lib/entry-points.js
generated
@@ -146398,7 +146398,7 @@ var persistInputs = function(env = getEnv()) {
|
||||
);
|
||||
core3.saveState(persistedInputsKey, JSON.stringify(inputEnvironmentVariables));
|
||||
};
|
||||
var restoreInputs = function() {
|
||||
function restoreInputs(logger) {
|
||||
try {
|
||||
const persistedInputsValue = core3.getState(persistedInputsKey);
|
||||
if (persistedInputsValue) {
|
||||
@@ -146408,9 +146408,12 @@ var restoreInputs = function() {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
logger.error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
throw new Error(
|
||||
"Failed to restore inputs from the state set by this action's main execution."
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getPullRequestBranches(env = getEnv()) {
|
||||
const pullRequest = github.context.payload.pull_request;
|
||||
if (pullRequest) {
|
||||
@@ -161729,8 +161732,8 @@ async function createDatabaseBundleCli(codeql, config, language) {
|
||||
// src/analyze-action-post.ts
|
||||
async function runWrapper2() {
|
||||
try {
|
||||
restoreInputs();
|
||||
const logger = getActionsLogger();
|
||||
restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] === "true") {
|
||||
@@ -163026,7 +163029,7 @@ async function run4(startedAt) {
|
||||
let dependencyCachingUsage;
|
||||
try {
|
||||
const jobStatus2 = getOptionalInput("job-status");
|
||||
restoreInputs();
|
||||
restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
const repositoryNwo = getRepositoryNwo();
|
||||
@@ -164177,7 +164180,7 @@ var core29 = __toESM(require_core());
|
||||
async function runWrapper9() {
|
||||
const logger = getActionsLogger();
|
||||
try {
|
||||
restoreInputs();
|
||||
restoreInputs(logger);
|
||||
const pid = core29.getState("proxy-process-pid");
|
||||
if (pid) {
|
||||
process.kill(Number(pid));
|
||||
@@ -164328,8 +164331,8 @@ async function runWrapper10() {
|
||||
var core31 = __toESM(require_core());
|
||||
async function runWrapper11() {
|
||||
try {
|
||||
restoreInputs();
|
||||
const logger = getActionsLogger();
|
||||
restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
if (process.env["CODEQL_ACTION_INIT_HAS_RUN" /* INIT_ACTION_HAS_RUN */] !== "true") {
|
||||
|
||||
@@ -413,7 +413,7 @@ export const persistInputs = function (env: Env = getEnv()) {
|
||||
/**
|
||||
* Restores all inputs to the action from the persisted state.
|
||||
*/
|
||||
export const restoreInputs = function () {
|
||||
export function restoreInputs(logger: Logger) {
|
||||
try {
|
||||
const persistedInputsValue = core.getState(persistedInputsKey);
|
||||
if (persistedInputsValue) {
|
||||
@@ -424,9 +424,12 @@ export const restoreInputs = function () {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
logger.error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
throw new Error(
|
||||
"Failed to restore inputs from the state set by this action's main execution.",
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export interface PullRequestBranches {
|
||||
base: string;
|
||||
|
||||
@@ -25,8 +25,8 @@ export async function runWrapper() {
|
||||
// possible, and only use safe functions outside.
|
||||
|
||||
try {
|
||||
actionsUtil.restoreInputs();
|
||||
const logger = getActionsLogger();
|
||||
actionsUtil.restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ async function run(startedAt: Date) {
|
||||
const jobStatus = getOptionalInput("job-status");
|
||||
|
||||
// Restore inputs from `init` Action.
|
||||
restoreInputs();
|
||||
restoreInputs(logger);
|
||||
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function runWrapper() {
|
||||
|
||||
try {
|
||||
// Restore inputs from `start-proxy` Action.
|
||||
actionsUtil.restoreInputs();
|
||||
actionsUtil.restoreInputs(logger);
|
||||
|
||||
// Kill the running proxy
|
||||
const pid = core.getState("proxy-process-pid");
|
||||
|
||||
@@ -17,9 +17,10 @@ export async function runWrapper() {
|
||||
// possible, and only use safe functions outside.
|
||||
|
||||
try {
|
||||
// Restore inputs from `upload-sarif` Action.
|
||||
actionsUtil.restoreInputs();
|
||||
const logger = getActionsLogger();
|
||||
|
||||
// Restore inputs from `upload-sarif` Action.
|
||||
actionsUtil.restoreInputs(logger);
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user