UNPKG

@jsdevtools/npm-publish

Version:
55 lines 1.58 kB
/** Wrapper module for @actions/core */ import { debug as ghLogDebug, error as ghLogError, getInput as ghGetInput, info as ghLogInfo, setFailed as ghSetFailed, setOutput as ghSetOutput, setSecret as ghSetSecret, } from "@actions/core"; /** Logger using the methods from @actions/core. */ export const logger = { debug: ghLogDebug, info: ghLogInfo, error: ghLogError, }; /** * Get input by name. * * @param name Input name * @returns The input string value, or undefined if not set */ export function getInput(name) { const inputString = ghGetInput(name); return inputString.length > 0 ? inputString : undefined; } /** * Get a required secret input by name. * * @param name Input name * @returns The input secret value. */ export function getRequiredSecretInput(name) { const inputString = ghGetInput(name, { required: true }); ghSetSecret(inputString); return inputString; } /** * Get a boolean input by name. * * @param name Input name * @returns True if value is "true", false if "false", undefined if unset */ export function getBooleanInput(name) { const inputString = ghGetInput(name).toLowerCase(); if (inputString === "true") return true; if (inputString === "false") return false; return undefined; } /** * Set the action as failed due to an error. * * @param error An value from a `catch` */ export function setFailed(error) { ghSetFailed(error); } export function setOutput(name, value, defaultValue) { ghSetOutput(name, value ?? defaultValue); } //# sourceMappingURL=core.js.map