Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 1x 1x 1x 2x 1x 1x 1x 8x 1x 13x 1x 3x 1x 1x 1x 2x 1x 2x 1x | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Utils = exports.setFailed = exports.command = exports.setOutput = exports.getEnvironmentVariable = exports.getMultiLineInput = exports.getInput = void 0;
const command_wrapper_1 = require("./command-wrapper");
/**
* Provides the value of the action parameter as setup on the workflow definition.
* Limits the value to a single line.
*
* @param inputVar The name of the environment variable. The value is sanitized by escaping special characters.
*
* @returns The value of the resolved input variable as setup in the workflow definition.
*/
function getInput(inputVar) {
return (0, command_wrapper_1.validateInput)(getEnvironmentVariable('INPUT_' + inputVar.toUpperCase()));
}
exports.getInput = getInput;
/**
* Provides the multi-line value of the action parameter as setup on the workflow definition.
*
* @param inputVar The name of the environment variable. The value is sanitized by escaping special characters.
*
* @returns The multi-line value of the resolved input variable as setup in the workflow definition.
*/
function getMultiLineInput(inputVar) {
return getEnvironmentVariable('INPUT_' + inputVar.toUpperCase());
}
exports.getMultiLineInput = getMultiLineInput;
/**
* Provides the value of the environment variable as setup in the workflow definition and runtime environment.
* Limits the value to a single line.
*
* @param inputVar The name of the environment variable. The value is sanitized by escaping special characters.
*
* @return The value of the environment variable. Limits to a single line.
*/
function getEnvironmentVariable(inputVar) {
return (0, command_wrapper_1.getInputParam)(inputVar);
}
exports.getEnvironmentVariable = getEnvironmentVariable;
/**
* Sets the output value for the action output parameter.
*
* @param varName The name of the environment variable. The variable must match the ^[A-Za-z0-9@\-_]+$ pattern.
* @param varValue The fully resolved value of the output variable.
*
* @return The result of running `echo ${varName}`.
*/
function setOutput(varName, varValue) {
return (0, command_wrapper_1.setOutputParam)(varName, varValue);
}
exports.setOutput = setOutput;
/**
* Executes the command on the runtime.
* Both command and its argument are sanitized (escaped) before execution.
*
* @param cmd The command to execute.
* @param args The command arguments.
* @param sanitizeInput If true, all the input is sanitized.
* @param disableStdInput (since v1.0.13) If true, standard input will be disabled for the command.
* @return {@link ICommandOutput | `Command Output`}: The complex object with runtime execution parameters.
*/
function command(cmd, sanitizeInput = true, disableStdInput = true, args) {
return (0, command_wrapper_1.runCommand)(cmd, sanitizeInput, disableStdInput, args);
}
exports.command = command;
/**
* Sets the action as failed with associated message.
*
* @param message The message as to why the action failed.
*/
function setFailed(message) {
(0, command_wrapper_1.setFailure)(message, 1);
}
exports.setFailed = setFailed;
/**
* Utility class wrapping core methods.
*/
class Utils {
/** View documentation at {@link getInput | `getInput`} */
static getInput(inputVar) {
return (0, command_wrapper_1.validateInput)(getEnvironmentVariable('INPUT_' + (inputVar === null || inputVar === void 0 ? void 0 : inputVar.toUpperCase())));
}
/** View documentation at {@link getMultiLineInput | `getMultiLineInput`} */
static getMultiLineInput(inputVar) {
return getEnvironmentVariable('INPUT_' + (inputVar === null || inputVar === void 0 ? void 0 : inputVar.toUpperCase()));
}
/** View documentation at {@link getEnvironmentVariable | `getEnvironmentVariable`} */
static getEnvironmentVariable(inputVar) {
return (0, command_wrapper_1.getInputParam)(inputVar);
}
/** View documentation at {@link setOutput | `setOutput`} */
static setOutput(varName, varValue) {
return (0, command_wrapper_1.setOutputParam)(varName, varValue);
}
/** View documentation at {@link command | `command`} */
static command(cmd, sanitizeInput = true, disableStdInput = true, args) {
return (0, command_wrapper_1.runCommand)(cmd, sanitizeInput, disableStdInput, args);
}
}
exports.Utils = Utils;
|