"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const exit_1 = require("@actions/exit"); const command_1 = require("./command"); const path = require("path"); //----------------------------------------------------------------------- // Variables //----------------------------------------------------------------------- /** * sets env variable for this action and future actions in the job * @param name the name of the variable to set * @param val the value of the variable */ function exportVariable(name, val) { process.env[name] = val; command_1.issueCommand('set-env', { name }, val); } exports.exportVariable = exportVariable; /** * exports the variable and registers a secret which will get masked from logs * @param name the name of the variable to set * @param val value of the secret */ function exportSecret(name, val) { exportVariable(name, val); command_1.issueCommand('set-secret', {}, val); } exports.exportSecret = exportSecret; /** * Prepends inputPath to the PATH (for this action and future actions) * @param inputPath */ function addPath(inputPath) { command_1.issueCommand('add-path', {}, inputPath); process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; } exports.addPath = addPath; /** * Gets the value of an input. The value is also trimmed. * * @param name name of the input to get * @param options optional. See InputOptions. * @returns string */ function getInput(name, options) { const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || ''; if (options && options.required && !val) { throw new Error(`Input required and not supplied: ${name}`); } return val.trim(); } exports.getInput = getInput; //----------------------------------------------------------------------- // Results //----------------------------------------------------------------------- /** * Sets the action status to neutral */ function setNeutral() { process.exitCode = exit_1.ExitCode.Neutral; } exports.setNeutral = setNeutral; /** * Sets the action status to failed. * When the action exits it will be with an exit code of 1 * @param message add error issue message */ function setFailed(message) { process.exitCode = exit_1.ExitCode.Failure; error(message); } exports.setFailed = setFailed; //----------------------------------------------------------------------- // Logging Commands //----------------------------------------------------------------------- /** * Writes debug message to user log * @param message debug message */ function debug(message) { command_1.issueCommand('debug', {}, message); } exports.debug = debug; /** * Adds an error issue * @param message error issue message */ function error(message) { command_1.issue('error', message); } exports.error = error; /** * Adds an warning issue * @param message warning issue message */ function warning(message) { command_1.issue('warning', message); } exports.warning = warning; //# sourceMappingURL=core.js.map