diff --git a/dist/blog-post-workflow.js b/dist/blog-post-workflow.js index c47b13e..5df6ff0 100644 --- a/dist/blog-post-workflow.js +++ b/dist/blog-post-workflow.js @@ -6766,59 +6766,6 @@ var require_command = __commonJS({ } }); -// node_modules/@actions/core/lib/file-command.js -var require_file_command = __commonJS({ - "node_modules/@actions/core/lib/file-command.js"(exports2) { - "use strict"; - var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k in mod) - if (k !== "default" && Object.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); - } - __setModuleDefault(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.issueCommand = void 0; - var fs2 = __importStar(require("fs")); - var os = __importStar(require("os")); - var utils_1 = require_utils2(); - function issueCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`]; - if (!filePath) { - throw new Error(`Unable to find environment variable for file command ${command}`); - } - if (!fs2.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`); - } - fs2.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { - encoding: "utf8" - }); - } - exports2.issueCommand = issueCommand; - } -}); - // node_modules/uuid/dist/rng.js var require_rng = __commonJS({ "node_modules/uuid/dist/rng.js"(exports2) { @@ -7310,6 +7257,72 @@ var require_dist = __commonJS({ } }); +// node_modules/@actions/core/lib/file-command.js +var require_file_command = __commonJS({ + "node_modules/@actions/core/lib/file-command.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; + var fs2 = __importStar(require("fs")); + var os = __importStar(require("os")); + var uuid_1 = require_dist(); + var utils_1 = require_utils2(); + function issueFileCommand(command, message) { + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs2.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs2.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: "utf8" + }); + } + exports2.issueFileCommand = issueFileCommand; + function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${uuid_1.v4()}`; + const convertedValue = utils_1.toCommandValue(value); + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; + } + exports2.prepareKeyValueMessage = prepareKeyValueMessage; + } +}); + // node_modules/@actions/http-client/lib/proxy.js var require_proxy = __commonJS({ "node_modules/@actions/http-client/lib/proxy.js"(exports2) { @@ -8631,7 +8644,6 @@ var require_core = __commonJS({ var utils_1 = require_utils2(); var os = __importStar(require("os")); var path2 = __importStar(require("path")); - var uuid_1 = require_dist(); var oidc_utils_1 = require_oidc_utils(); var ExitCode; (function(ExitCode2) { @@ -8643,18 +8655,9 @@ var require_core = __commonJS({ process.env[name] = convertedVal; const filePath = process.env["GITHUB_ENV"] || ""; if (filePath) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - if (name.includes(delimiter)) { - throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); - } - if (convertedVal.includes(delimiter)) { - throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); - } - const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; - file_command_1.issueCommand("ENV", commandValue); - } else { - command_1.issueCommand("set-env", { name }, convertedVal); + return file_command_1.issueFileCommand("ENV", file_command_1.prepareKeyValueMessage(name, val)); } + command_1.issueCommand("set-env", { name }, convertedVal); } exports2.exportVariable = exportVariable; function setSecret(secret) { @@ -8664,7 +8667,7 @@ var require_core = __commonJS({ function addPath(inputPath) { const filePath = process.env["GITHUB_PATH"] || ""; if (filePath) { - file_command_1.issueCommand("PATH", inputPath); + file_command_1.issueFileCommand("PATH", inputPath); } else { command_1.issueCommand("add-path", {}, inputPath); } @@ -8684,7 +8687,10 @@ var require_core = __commonJS({ exports2.getInput = getInput; function getMultilineInput(name, options) { const inputs = getInput(name, options).split("\n").filter((x) => x !== ""); - return inputs; + if (options && options.trimWhitespace === false) { + return inputs; + } + return inputs.map((input) => input.trim()); } exports2.getMultilineInput = getMultilineInput; function getBooleanInput(name, options) { @@ -8700,8 +8706,12 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.getBooleanInput = getBooleanInput; function setOutput(name, value) { + const filePath = process.env["GITHUB_OUTPUT"] || ""; + if (filePath) { + return file_command_1.issueFileCommand("OUTPUT", file_command_1.prepareKeyValueMessage(name, value)); + } process.stdout.write(os.EOL); - command_1.issueCommand("set-output", { name }, value); + command_1.issueCommand("set-output", { name }, utils_1.toCommandValue(value)); } exports2.setOutput = setOutput; function setCommandEcho(enabled) { @@ -8759,7 +8769,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } exports2.group = group; function saveState(name, value) { - command_1.issueCommand("save-state", { name }, value); + const filePath = process.env["GITHUB_STATE"] || ""; + if (filePath) { + return file_command_1.issueFileCommand("STATE", file_command_1.prepareKeyValueMessage(name, value)); + } + command_1.issueCommand("save-state", { name }, utils_1.toCommandValue(value)); } exports2.saveState = saveState; function getState(name) { diff --git a/package.json b/package.json index 082690d..45f0408 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blog-post-workflow", - "version": "1.7.8", + "version": "1.7.9", "description": "Allows you to show your latest blog posts on your github profile or project readme", "main": "blog-post-workflow.js", "scripts": {