mirror of
https://github.com/github/codeql-action.git
synced 2026-11-08 22:19:50 +00:00
Improve restoreInputs
This commit is contained in:
17
lib/entry-points.js
generated
17
lib/entry-points.js
generated
@@ -170390,17 +170390,22 @@ var persistInputs = function(env = getEnv()) {
|
||||
);
|
||||
core4.saveState(persistedInputsKey, JSON.stringify(inputEnvironmentVariables));
|
||||
};
|
||||
function restoreInputs(logger2) {
|
||||
function restoreInputs(action) {
|
||||
try {
|
||||
const persistedInputsValue = core4.getState(persistedInputsKey);
|
||||
const persistedInputsValue = action.actions.getState(persistedInputsKey);
|
||||
if (persistedInputsValue) {
|
||||
const persistedInputs = JSON.parse(persistedInputsValue);
|
||||
const persistedInputs = JSON.parse(
|
||||
persistedInputsValue
|
||||
);
|
||||
if (!Array.isArray(persistedInputs)) {
|
||||
throw new Error("Restored value is not an array.");
|
||||
}
|
||||
for (const [name, value] of persistedInputs) {
|
||||
process.env[name] = value;
|
||||
action.env.set(name, value);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger2.error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
action.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."
|
||||
);
|
||||
@@ -171783,7 +171788,7 @@ async function runInActions(action) {
|
||||
actions: actionsEnv
|
||||
};
|
||||
if (isPostAction(action.name)) {
|
||||
restoreInputs(logger2);
|
||||
restoreInputs(actionState);
|
||||
}
|
||||
getJobUUID(actionState);
|
||||
await action.run(actionState);
|
||||
|
||||
Reference in New Issue
Block a user