Skip to content

Commit 62cfaee

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent f08ec87 commit 62cfaee

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

dist/index.js

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21232,14 +21232,28 @@ class Command {
2123221232
return cmdStr;
2123321233
}
2123421234
}
21235+
/**
21236+
* Sanitizes an input into a string so it can be passed into issueCommand safely
21237+
* @param input input to sanitize into a string
21238+
*/
21239+
function toCommandValue(input) {
21240+
if (input === null || input === undefined) {
21241+
return '';
21242+
}
21243+
else if (typeof input === 'string' || input instanceof String) {
21244+
return input;
21245+
}
21246+
return JSON.stringify(input);
21247+
}
21248+
exports.toCommandValue = toCommandValue;
2123521249
function escapeData(s) {
21236-
return (s || '')
21250+
return toCommandValue(s)
2123721251
.replace(/%/g, '%25')
2123821252
.replace(/\r/g, '%0D')
2123921253
.replace(/\n/g, '%0A');
2124021254
}
2124121255
function escapeProperty(s) {
21242-
return (s || '')
21256+
return toCommandValue(s)
2124321257
.replace(/%/g, '%25')
2124421258
.replace(/\r/g, '%0D')
2124521259
.replace(/\n/g, '%0A')
@@ -29066,11 +29080,13 @@ var ExitCode;
2906629080
/**
2906729081
* Sets env variable for this action and future actions in the job
2906829082
* @param name the name of the variable to set
29069-
* @param val the value of the variable
29083+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
2907029084
*/
29085+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2907129086
function exportVariable(name, val) {
29072-
process.env[name] = val;
29073-
command_1.issueCommand('set-env', { name }, val);
29087+
const convertedVal = command_1.toCommandValue(val);
29088+
process.env[name] = convertedVal;
29089+
command_1.issueCommand('set-env', { name }, convertedVal);
2907429090
}
2907529091
exports.exportVariable = exportVariable;
2907629092
/**
@@ -29109,12 +29125,22 @@ exports.getInput = getInput;
2910929125
* Sets the value of an output.
2911029126
*
2911129127
* @param name name of the output to set
29112-
* @param value value to store
29128+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
2911329129
*/
29130+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2911429131
function setOutput(name, value) {
2911529132
command_1.issueCommand('set-output', { name }, value);
2911629133
}
2911729134
exports.setOutput = setOutput;
29135+
/**
29136+
* Enables or disables the echoing of commands into stdout for the rest of the step.
29137+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
29138+
*
29139+
*/
29140+
function setCommandEcho(enabled) {
29141+
command_1.issue('echo', enabled ? 'on' : 'off');
29142+
}
29143+
exports.setCommandEcho = setCommandEcho;
2911829144
//-----------------------------------------------------------------------
2911929145
// Results
2912029146
//-----------------------------------------------------------------------
@@ -29148,18 +29174,18 @@ function debug(message) {
2914829174
exports.debug = debug;
2914929175
/**
2915029176
* Adds an error issue
29151-
* @param message error issue message
29177+
* @param message error issue message. Errors will be converted to string via toString()
2915229178
*/
2915329179
function error(message) {
29154-
command_1.issue('error', message);
29180+
command_1.issue('error', message instanceof Error ? message.toString() : message);
2915529181
}
2915629182
exports.error = error;
2915729183
/**
2915829184
* Adds an warning issue
29159-
* @param message warning issue message
29185+
* @param message warning issue message. Errors will be converted to string via toString()
2916029186
*/
2916129187
function warning(message) {
29162-
command_1.issue('warning', message);
29188+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
2916329189
}
2916429190
exports.warning = warning;
2916529191
/**
@@ -29217,8 +29243,9 @@ exports.group = group;
2921729243
* Saves state for current action, the state can only be retrieved by this action's post job execution.
2921829244
*
2921929245
* @param name name of the state to store
29220-
* @param value value to store
29246+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
2922129247
*/
29248+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2922229249
function saveState(name, value) {
2922329250
command_1.issueCommand('save-state', { name }, value);
2922429251
}

0 commit comments

Comments
 (0)