From 392a0914c38f85d010a4adfa39f91b525cb95016 Mon Sep 17 00:00:00 2001 From: Junjie Tang <33489572+jjtang1985@users.noreply.github.com> Date: Thu, 18 Feb 2021 19:02:18 +0100 Subject: [PATCH] fix: @action/core with clean install (#1021) --- .../@actions/core/lib/file-command.d.ts | 1 + .../@actions/core/lib/file-command.js | 29 +++++++++++++++++++ .../node_modules/@actions/core/lib/utils.d.ts | 5 ++++ .../node_modules/@actions/core/lib/utils.js | 19 ++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 .github/actions/get-changelog/node_modules/@actions/core/lib/file-command.d.ts create mode 100644 .github/actions/get-changelog/node_modules/@actions/core/lib/file-command.js create mode 100644 .github/actions/get-changelog/node_modules/@actions/core/lib/utils.d.ts create mode 100644 .github/actions/get-changelog/node_modules/@actions/core/lib/utils.js diff --git a/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.d.ts b/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.d.ts new file mode 100644 index 0000000000..ed408eb132 --- /dev/null +++ b/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.d.ts @@ -0,0 +1 @@ +export declare function issueCommand(command: string, message: any): void; diff --git a/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.js b/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.js new file mode 100644 index 0000000000..10783c0c27 --- /dev/null +++ b/.github/actions/get-changelog/node_modules/@actions/core/lib/file-command.js @@ -0,0 +1,29 @@ +"use strict"; +// For internal use, subject to change. +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(require("fs")); +const os = __importStar(require("os")); +const utils_1 = require("./utils"); +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 (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueCommand = issueCommand; +//# sourceMappingURL=file-command.js.map \ No newline at end of file diff --git a/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.d.ts b/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.d.ts new file mode 100644 index 0000000000..b39c9be982 --- /dev/null +++ b/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.d.ts @@ -0,0 +1,5 @@ +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +export declare function toCommandValue(input: any): string; diff --git a/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.js b/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.js new file mode 100644 index 0000000000..97cea339fc --- /dev/null +++ b/.github/actions/get-changelog/node_modules/@actions/core/lib/utils.js @@ -0,0 +1,19 @@ +"use strict"; +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; +//# sourceMappingURL=utils.js.map \ No newline at end of file