diff options
Diffstat (limited to 'node_modules/@actions/core/lib/core.js')
| -rw-r--r-- | node_modules/@actions/core/lib/core.js | 164 |
1 files changed, 51 insertions, 113 deletions
diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js index 6ad8ee2..cac059f 100644 --- a/node_modules/@actions/core/lib/core.js +++ b/node_modules/@actions/core/lib/core.js @@ -1,37 +1,3 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -41,39 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.platform = exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = exports.markdownSummary = exports.summary = exports.ExitCode = void 0; -exports.exportVariable = exportVariable; -exports.setSecret = setSecret; -exports.addPath = addPath; -exports.getInput = getInput; -exports.getMultilineInput = getMultilineInput; -exports.getBooleanInput = getBooleanInput; -exports.setOutput = setOutput; -exports.setCommandEcho = setCommandEcho; -exports.setFailed = setFailed; -exports.isDebug = isDebug; -exports.debug = debug; -exports.error = error; -exports.warning = warning; -exports.notice = notice; -exports.info = info; -exports.startGroup = startGroup; -exports.endGroup = endGroup; -exports.group = group; -exports.saveState = saveState; -exports.getState = getState; -exports.getIDToken = getIDToken; -const command_1 = require("./command"); -const file_command_1 = require("./file-command"); -const utils_1 = require("./utils"); -const os = __importStar(require("os")); -const path = __importStar(require("path")); -const oidc_utils_1 = require("./oidc-utils"); +import { issue, issueCommand } from './command.js'; +import { issueFileCommand, prepareKeyValueMessage } from './file-command.js'; +import { toCommandProperties, toCommandValue } from './utils.js'; +import * as os from 'os'; +import * as path from 'path'; +import { OidcClient } from './oidc-utils.js'; /** * The code to exit an action */ -var ExitCode; +export var ExitCode; (function (ExitCode) { /** * A code indicating that the action was successful @@ -83,7 +26,7 @@ var ExitCode; * A code indicating that the action was a failure */ ExitCode[ExitCode["Failure"] = 1] = "Failure"; -})(ExitCode || (exports.ExitCode = ExitCode = {})); +})(ExitCode || (ExitCode = {})); //----------------------------------------------------------------------- // Variables //----------------------------------------------------------------------- @@ -93,14 +36,14 @@ var ExitCode; * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -function exportVariable(name, val) { - const convertedVal = (0, utils_1.toCommandValue)(val); +export function exportVariable(name, val) { + const convertedVal = toCommandValue(val); process.env[name] = convertedVal; const filePath = process.env['GITHUB_ENV'] || ''; if (filePath) { - return (0, file_command_1.issueFileCommand)('ENV', (0, file_command_1.prepareKeyValueMessage)(name, val)); + return issueFileCommand('ENV', prepareKeyValueMessage(name, val)); } - (0, command_1.issueCommand)('set-env', { name }, convertedVal); + issueCommand('set-env', { name }, convertedVal); } /** * Registers a secret which will get masked from logs @@ -131,20 +74,20 @@ function exportVariable(name, val) { * console.log(`Using token: ${apiToken}`); // Outputs: "Using token: ***" * ``` */ -function setSecret(secret) { - (0, command_1.issueCommand)('add-mask', {}, secret); +export function setSecret(secret) { + issueCommand('add-mask', {}, secret); } /** * Prepends inputPath to the PATH (for this action and future actions) * @param inputPath */ -function addPath(inputPath) { +export function addPath(inputPath) { const filePath = process.env['GITHUB_PATH'] || ''; if (filePath) { - (0, file_command_1.issueFileCommand)('PATH', inputPath); + issueFileCommand('PATH', inputPath); } else { - (0, command_1.issueCommand)('add-path', {}, inputPath); + issueCommand('add-path', {}, inputPath); } process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; } @@ -157,7 +100,7 @@ function addPath(inputPath) { * @param options optional. See InputOptions. * @returns string */ -function getInput(name, options) { +export function getInput(name, options) { const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; if (options && options.required && !val) { throw new Error(`Input required and not supplied: ${name}`); @@ -175,7 +118,7 @@ function getInput(name, options) { * @returns string[] * */ -function getMultilineInput(name, options) { +export function getMultilineInput(name, options) { const inputs = getInput(name, options) .split('\n') .filter(x => x !== ''); @@ -194,7 +137,7 @@ function getMultilineInput(name, options) { * @param options optional. See InputOptions. * @returns boolean */ -function getBooleanInput(name, options) { +export function getBooleanInput(name, options) { const trueValue = ['true', 'True', 'TRUE']; const falseValue = ['false', 'False', 'FALSE']; const val = getInput(name, options); @@ -212,21 +155,21 @@ function getBooleanInput(name, options) { * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -function setOutput(name, value) { +export function setOutput(name, value) { const filePath = process.env['GITHUB_OUTPUT'] || ''; if (filePath) { - return (0, file_command_1.issueFileCommand)('OUTPUT', (0, file_command_1.prepareKeyValueMessage)(name, value)); + return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value)); } process.stdout.write(os.EOL); - (0, command_1.issueCommand)('set-output', { name }, (0, utils_1.toCommandValue)(value)); + issueCommand('set-output', { name }, toCommandValue(value)); } /** * Enables or disables the echoing of commands into stdout for the rest of the step. * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. * */ -function setCommandEcho(enabled) { - (0, command_1.issue)('echo', enabled ? 'on' : 'off'); +export function setCommandEcho(enabled) { + issue('echo', enabled ? 'on' : 'off'); } //----------------------------------------------------------------------- // Results @@ -236,7 +179,7 @@ function setCommandEcho(enabled) { * When the action exits it will be with an exit code of 1 * @param message add error issue message */ -function setFailed(message) { +export function setFailed(message) { process.exitCode = ExitCode.Failure; error(message); } @@ -246,45 +189,45 @@ function setFailed(message) { /** * Gets whether Actions Step Debug is on or not */ -function isDebug() { +export function isDebug() { return process.env['RUNNER_DEBUG'] === '1'; } /** * Writes debug message to user log * @param message debug message */ -function debug(message) { - (0, command_1.issueCommand)('debug', {}, message); +export function debug(message) { + issueCommand('debug', {}, message); } /** * Adds an error issue * @param message error issue message. Errors will be converted to string via toString() * @param properties optional properties to add to the annotation. */ -function error(message, properties = {}) { - (0, command_1.issueCommand)('error', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); +export function error(message, properties = {}) { + issueCommand('error', toCommandProperties(properties), message instanceof Error ? message.toString() : message); } /** * Adds a warning issue * @param message warning issue message. Errors will be converted to string via toString() * @param properties optional properties to add to the annotation. */ -function warning(message, properties = {}) { - (0, command_1.issueCommand)('warning', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); +export function warning(message, properties = {}) { + issueCommand('warning', toCommandProperties(properties), message instanceof Error ? message.toString() : message); } /** * Adds a notice issue * @param message notice issue message. Errors will be converted to string via toString() * @param properties optional properties to add to the annotation. */ -function notice(message, properties = {}) { - (0, command_1.issueCommand)('notice', (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); +export function notice(message, properties = {}) { + issueCommand('notice', toCommandProperties(properties), message instanceof Error ? message.toString() : message); } /** * Writes info to log with console.log. * @param message info message */ -function info(message) { +export function info(message) { process.stdout.write(message + os.EOL); } /** @@ -294,14 +237,14 @@ function info(message) { * * @param name The name of the output group */ -function startGroup(name) { - (0, command_1.issue)('group', name); +export function startGroup(name) { + issue('group', name); } /** * End an output group. */ -function endGroup() { - (0, command_1.issue)('endgroup'); +export function endGroup() { + issue('endgroup'); } /** * Wrap an asynchronous function call in a group. @@ -311,7 +254,7 @@ function endGroup() { * @param name The name of the group * @param fn The function to wrap in the group */ -function group(name, fn) { +export function group(name, fn) { return __awaiter(this, void 0, void 0, function* () { startGroup(name); let result; @@ -334,12 +277,12 @@ function group(name, fn) { * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -function saveState(name, value) { +export function saveState(name, value) { const filePath = process.env['GITHUB_STATE'] || ''; if (filePath) { - return (0, file_command_1.issueFileCommand)('STATE', (0, file_command_1.prepareKeyValueMessage)(name, value)); + return issueFileCommand('STATE', prepareKeyValueMessage(name, value)); } - (0, command_1.issueCommand)('save-state', { name }, (0, utils_1.toCommandValue)(value)); + issueCommand('save-state', { name }, toCommandValue(value)); } /** * Gets the value of an state set by this action's main execution. @@ -347,33 +290,28 @@ function saveState(name, value) { * @param name name of the state to get * @returns string */ -function getState(name) { +export function getState(name) { return process.env[`STATE_${name}`] || ''; } -function getIDToken(aud) { +export function getIDToken(aud) { return __awaiter(this, void 0, void 0, function* () { - return yield oidc_utils_1.OidcClient.getIDToken(aud); + return yield OidcClient.getIDToken(aud); }); } /** * Summary exports */ -var summary_1 = require("./summary"); -Object.defineProperty(exports, "summary", { enumerable: true, get: function () { return summary_1.summary; } }); +export { summary } from './summary.js'; /** * @deprecated use core.summary */ -var summary_2 = require("./summary"); -Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function () { return summary_2.markdownSummary; } }); +export { markdownSummary } from './summary.js'; /** * Path exports */ -var path_utils_1 = require("./path-utils"); -Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } }); -Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } }); -Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }); +export { toPosixPath, toWin32Path, toPlatformPath } from './path-utils.js'; /** * Platform utilities exports */ -exports.platform = __importStar(require("./platform")); +export * as platform from './platform.js'; //# sourceMappingURL=core.js.map
\ No newline at end of file |
