mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Wrap JSON parse errors in restoreInputs with context
This commit is contained in:
13
lib/entry-points.js
generated
13
lib/entry-points.js
generated
@@ -146389,11 +146389,16 @@ var persistInputs = function(env = getEnv()) {
|
||||
core3.saveState(persistedInputsKey, JSON.stringify(inputEnvironmentVariables));
|
||||
};
|
||||
var restoreInputs = function() {
|
||||
const persistedInputs = core3.getState(persistedInputsKey);
|
||||
if (persistedInputs) {
|
||||
for (const [name, value] of JSON.parse(persistedInputs)) {
|
||||
process.env[name] = value;
|
||||
try {
|
||||
const persistedInputsValue = core3.getState(persistedInputsKey);
|
||||
const persistedInputs = JSON.parse(persistedInputsValue);
|
||||
if (persistedInputs) {
|
||||
for (const [name, value] of persistedInputs) {
|
||||
process.env[name] = value;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
}
|
||||
};
|
||||
function getPullRequestBranches(env = getEnv()) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
getCodeQLDatabasePath,
|
||||
ConfigurationError,
|
||||
getEnv,
|
||||
getErrorMessage,
|
||||
} from "./util";
|
||||
|
||||
/**
|
||||
@@ -413,11 +414,17 @@ export const persistInputs = function (env: Env = getEnv()) {
|
||||
* Restores all inputs to the action from the persisted state.
|
||||
*/
|
||||
export const restoreInputs = function () {
|
||||
const persistedInputs = core.getState(persistedInputsKey);
|
||||
if (persistedInputs) {
|
||||
for (const [name, value] of JSON.parse(persistedInputs)) {
|
||||
process.env[name] = value;
|
||||
try {
|
||||
const persistedInputsValue = core.getState(persistedInputsKey);
|
||||
const persistedInputs = JSON.parse(persistedInputsValue);
|
||||
|
||||
if (persistedInputs) {
|
||||
for (const [name, value] of persistedInputs) {
|
||||
process.env[name] = value;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Unable to restore inputs: ${getErrorMessage(err)}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user