diff --git a/build.json b/build.json index b6544be0..cff3c5be 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"owner":"technote-space","repo":"get-diff-action","sha":"83aa871c1c3b03d1fea23a8a5f937c7375c4cd54","ref":"refs/tags/test/v6.1.1.2937845757","tagName":"test/v6.1.1.2937845757","branch":"gh-actions","tags":["test/v6.1.1.2937845757","test/v6.1.1","test/v6.1","test/v6"],"updated_at":"2022-08-27T03:46:22.254Z"} \ No newline at end of file +{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v6.1.1","branch":"gh-actions","tags":["test/v6.1.1","test/v6.1","test/v6"],"updated_at":"2022-10-14T16:21:44.393Z"} \ No newline at end of file diff --git a/lib/main.js b/lib/main.js index 62faa074..007ac48e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,21 +16,6 @@ var require$$2$2 = require('url'); var require$$5 = require('zlib'); var child_process = require('child_process'); -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1); -var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0); -var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1); -var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1); -var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2$1); -var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3$1); -var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$1); -var require$$4__default = /*#__PURE__*/_interopDefaultLegacy(require$$4$1); -var require$$6__default = /*#__PURE__*/_interopDefaultLegacy(require$$6); -var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2); -var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$2); -var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5); - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { @@ -103,28 +88,28 @@ function toCommandProperties(annotationProperties) { } utils$4.toCommandProperties = toCommandProperties; -var __createBinding$4 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { +var __createBinding$3 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); -var __setModuleDefault$4 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { +var __setModuleDefault$3 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); -var __importStar$4 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { +var __importStar$3 = (commonjsGlobal && commonjsGlobal.__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$4(result, mod, k); - __setModuleDefault$4(result, mod); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding$3(result, mod, k); + __setModuleDefault$3(result, mod); return result; }; Object.defineProperty(command$1, "__esModule", { value: true }); command$1.issue = command$1.issueCommand = void 0; -const os$1 = __importStar$4(require$$0__default["default"]); +const os$1 = __importStar$3(require$$0); const utils_1$2 = utils$4; /** * Commands @@ -136,13 +121,13 @@ const utils_1$2 = utils$4; * ::warning::This is the message * ::set-env name=MY_VAR::some value */ -function issueCommand$1(command, properties, message) { +function issueCommand(command, properties, message) { const cmd = new Command$1(command, properties, message); process.stdout.write(cmd.toString() + os$1.EOL); } -command$1.issueCommand = issueCommand$1; +command$1.issueCommand = issueCommand; function issue(name, message = '') { - issueCommand$1(name, {}, message); + issueCommand(name, {}, message); } command$1.issue = issue; const CMD_STRING = '::'; @@ -196,47 +181,6 @@ function escapeProperty(s) { var fileCommand = {}; -// For internal use, subject to change. -var __createBinding$3 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault$3 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar$3 = (commonjsGlobal && commonjsGlobal.__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$3(result, mod, k); - __setModuleDefault$3(result, mod); - return result; -}; -Object.defineProperty(fileCommand, "__esModule", { value: true }); -fileCommand.issueCommand = void 0; -// We use any as a valid input type -/* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar$3(fs__default["default"]); -const os = __importStar$3(require$$0__default["default"]); -const utils_1$1 = utils$4; -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$1.toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }); -} -fileCommand.issueCommand = issueCommand; - var dist = {}; var v1$1 = {}; @@ -248,7 +192,7 @@ Object.defineProperty(rng$1, "__esModule", { }); rng$1.default = rng; -var _crypto$2 = _interopRequireDefault$b(require$$0__default$1["default"]); +var _crypto$2 = _interopRequireDefault$b(require$$0$1); function _interopRequireDefault$b(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -573,7 +517,7 @@ Object.defineProperty(md5$1, "__esModule", { }); md5$1.default = void 0; -var _crypto$1 = _interopRequireDefault$5(require$$0__default$1["default"]); +var _crypto$1 = _interopRequireDefault$5(require$$0$1); function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -652,7 +596,7 @@ Object.defineProperty(sha1$1, "__esModule", { }); sha1$1.default = void 0; -var _crypto = _interopRequireDefault$2(require$$0__default$1["default"]); +var _crypto = _interopRequireDefault$2(require$$0$1); function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -796,6 +740,63 @@ version$1.default = _default; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } } (dist)); +// For internal use, subject to change. +var __createBinding$2 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$2 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$2 = (commonjsGlobal && commonjsGlobal.__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$2(result, mod, k); + __setModuleDefault$2(result, mod); + return result; +}; +Object.defineProperty(fileCommand, "__esModule", { value: true }); +fileCommand.prepareKeyValueMessage = fileCommand.issueFileCommand = void 0; +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar$2(fs$1); +const os = __importStar$2(require$$0); +const uuid_1 = dist; +const utils_1$1 = utils$4; +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 (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1$1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +fileCommand.issueFileCommand = issueFileCommand; +function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${uuid_1.v4()}`; + const convertedValue = utils_1$1.toCommandValue(value); + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + 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}`; +} +fileCommand.prepareKeyValueMessage = prepareKeyValueMessage; + var oidcUtils = {}; var lib$2 = {}; @@ -866,11 +867,11 @@ var tunnel$1 = {exports: {}}; var tunnel = {}; -var tls = require$$1__default["default"]; -var http = require$$2__default["default"]; -var https = require$$3__default["default"]; -var events = require$$4__default["default"]; -var util = require$$6__default["default"]; +var tls = require$$1$1; +var http = require$$2$1; +var https = require$$3$1; +var events = require$$4$1; +var util = require$$6; tunnel.httpOverHttp = httpOverHttp; @@ -1163,8 +1164,8 @@ tunnel.debug = debug; // for test }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; - const http = __importStar(require$$2__default["default"]); - const https = __importStar(require$$3__default["default"]); + const http = __importStar(require$$2$1); + const https = __importStar(require$$3$1); const pm = __importStar(proxy); const tunnel = __importStar(tunnel$1.exports); var HttpCodes; @@ -1923,8 +1924,8 @@ function requireSummary () { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; - const os_1 = require$$0__default["default"]; - const fs_1 = fs__default["default"]; + const os_1 = require$$0; + const fs_1 = fs$1; const { access, appendFile, writeFile } = fs_1.promises; exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; @@ -2226,7 +2227,7 @@ function requirePathUtils () { }; Object.defineProperty(pathUtils, "__esModule", { value: true }); pathUtils.toPlatformPath = pathUtils.toWin32Path = pathUtils.toPosixPath = void 0; - const path = __importStar(path__default["default"]); + const path = __importStar(path$1); /** * toPosixPath converts the given path to the posix form. On Windows, \\ will be * replaced with /. @@ -2304,9 +2305,8 @@ function requireCore () { const command_1 = command$1; const file_command_1 = fileCommand; const utils_1 = utils$4; - const os = __importStar(require$$0__default["default"]); - const path = __importStar(path__default["default"]); - const uuid_1 = dist; + const os = __importStar(require$$0); + const path = __importStar(path$1); const oidc_utils_1 = requireOidcUtils(); /** * The code to exit an action @@ -2336,20 +2336,9 @@ function requireCore () { process.env[name] = convertedVal; const filePath = process.env['GITHUB_ENV'] || ''; if (filePath) { - const delimiter = `ghadelimiter_${uuid_1.v4()}`; - // These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter. - 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); } exports.exportVariable = exportVariable; /** @@ -2367,7 +2356,7 @@ function requireCore () { 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); @@ -2407,7 +2396,10 @@ function requireCore () { 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()); } exports.getMultilineInput = getMultilineInput; /** @@ -2440,8 +2432,12 @@ function requireCore () { */ // eslint-disable-next-line @typescript-eslint/no-explicit-any 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)); } exports.setOutput = setOutput; /** @@ -2570,7 +2566,11 @@ function requireCore () { */ // eslint-disable-next-line @typescript-eslint/no-explicit-any 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)); } exports.saveState = saveState; /** @@ -2617,9 +2617,9 @@ var context = {}; Object.defineProperty(context, "__esModule", { value: true }); var Context_1 = context.Context = void 0; -const fs_1 = fs__default["default"]; -const os_1 = require$$0__default["default"]; -class Context$2 { +const fs_1 = fs$1; +const os_1 = require$$0; +class Context$1 { /** * Hydrate the context from the environment */ @@ -2666,7 +2666,7 @@ class Context$2 { throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); } } -Context_1 = context.Context = Context$2; +Context_1 = context.Context = Context$1; const getBoolValue$1 = (input) => !['false', '0', '', 'no', 'n'].includes(input.trim().toLowerCase()); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -2711,28 +2711,28 @@ var utils$3 = {}; var utils$2 = {}; -var __createBinding$2 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { +var __createBinding$1 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); -var __setModuleDefault$2 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { +var __setModuleDefault$1 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); -var __importStar$2 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { +var __importStar$1 = (commonjsGlobal && commonjsGlobal.__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$2(result, mod, k); - __setModuleDefault$2(result, mod); + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k); + __setModuleDefault$1(result, mod); return result; }; Object.defineProperty(utils$2, "__esModule", { value: true }); utils$2.getApiBaseUrl = utils$2.getProxyAgent = utils$2.getAuthString = void 0; -const httpClient = __importStar$2(lib$2); +const httpClient = __importStar$1(lib$2); function getAuthString(token, options) { if (!token && !options.auth) { throw new Error('Parameter token or opts.auth is required'); @@ -2868,45 +2868,49 @@ var removeHook = remove; var bind = Function.bind; var bindable = bind.bind(bind); -function bindApi (hook, state, name) { - var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]); +function bindApi(hook, state, name) { + var removeHookRef = bindable(removeHook, null).apply( + null, + name ? [state, name] : [state] + ); hook.api = { remove: removeHookRef }; - hook.remove = removeHookRef - - ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { + hook.remove = removeHookRef; + ["before", "error", "after", "wrap"].forEach(function (kind) { var args = name ? [state, kind, name] : [state, kind]; hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args); }); } -function HookSingular () { - var singularHookName = 'h'; +function HookSingular() { + var singularHookName = "h"; var singularHookState = { - registry: {} + registry: {}, }; var singularHook = register.bind(null, singularHookState, singularHookName); bindApi(singularHook, singularHookState, singularHookName); - return singularHook + return singularHook; } -function HookCollection () { +function HookCollection() { var state = { - registry: {} + registry: {}, }; var hook = register.bind(null, state); bindApi(hook, state); - return hook + return hook; } var collectionHookDeprecationMessageDisplayed = false; -function Hook () { +function Hook() { if (!collectionHookDeprecationMessageDisplayed) { - console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'); + console.warn( + '[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4' + ); collectionHookDeprecationMessageDisplayed = true; } - return HookCollection() + return HookCollection(); } Hook.Singular = HookSingular.bind(); @@ -83543,12 +83547,12 @@ publicApi.parseURL = urlStateMachine.exports.parseURL; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - var Stream = _interopDefault(require$$0__default$2["default"]); - var http = _interopDefault(require$$2__default["default"]); - var Url = _interopDefault(require$$2__default$1["default"]); + var Stream = _interopDefault(require$$0$2); + var http = _interopDefault(require$$2$1); + var Url = _interopDefault(require$$2$2); var whatwgUrl = _interopDefault(publicApi); - var https = _interopDefault(require$$3__default["default"]); - var zlib = _interopDefault(require$$5__default["default"]); + var https = _interopDefault(require$$3$1); + var zlib = _interopDefault(require$$5); // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js @@ -87936,58 +87940,61 @@ var distWeb = /*#__PURE__*/Object.freeze({ var require$$4 = /*@__PURE__*/getAugmentedNamespace(distWeb); -var __createBinding$1 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault$1 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar$1 = (commonjsGlobal && commonjsGlobal.__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$1(result, mod, k); - __setModuleDefault$1(result, mod); - return result; -}; -Object.defineProperty(utils$3, "__esModule", { value: true }); -utils$3.getOctokitOptions = utils$3.GitHub = utils$3.context = void 0; -const Context$1 = __importStar$1(context); -const Utils = __importStar$1(utils$2); -// octokit + plugins -const core_1 = require$$2; -const plugin_rest_endpoint_methods_1 = require$$3; -const plugin_paginate_rest_1 = require$$4; -utils$3.context = new Context$1.Context(); -const baseUrl = Utils.getApiBaseUrl(); -const defaults = { - baseUrl, - request: { - agent: Utils.getProxyAgent(baseUrl) - } -}; -utils$3.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults); -/** - * Convience function to correctly format Octokit Options to pass into the constructor. - * - * @param token the repo PAT or GITHUB_TOKEN - * @param options other options to set - */ -function getOctokitOptions(token, options) { - const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller - // Auth - const auth = Utils.getAuthString(token, opts); - if (auth) { - opts.auth = auth; - } - return opts; -} -utils$3.getOctokitOptions = getOctokitOptions; +(function (exports) { + var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar = (commonjsGlobal && commonjsGlobal.__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(exports, "__esModule", { value: true }); + exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0; + const Context = __importStar(context); + const Utils = __importStar(utils$2); + // octokit + plugins + const core_1 = require$$2; + const plugin_rest_endpoint_methods_1 = require$$3; + const plugin_paginate_rest_1 = require$$4; + exports.context = new Context.Context(); + const baseUrl = Utils.getApiBaseUrl(); + exports.defaults = { + baseUrl, + request: { + agent: Utils.getProxyAgent(baseUrl) + } + }; + exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults); + /** + * Convience function to correctly format Octokit Options to pass into the constructor. + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ + function getOctokitOptions(token, options) { + const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller + // Auth + const auth = Utils.getAuthString(token, opts); + if (auth) { + opts.auth = auth; + } + return opts; + } + exports.getOctokitOptions = getOctokitOptions; + +} (utils$3)); var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; @@ -88019,8 +88026,9 @@ github.context = new Context.Context(); * @param token the repo PAT or GITHUB_TOKEN * @param options other options to set */ -function getOctokit$1(token, options) { - return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); +function getOctokit$1(token, options, ...additionalPlugins) { + const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins); + return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options)); } getOctokit_1 = github.getOctokit = getOctokit$1; @@ -88044,17 +88052,17 @@ function shellescape(a) { const getRef = (ref) => typeof ref === 'string' ? ref : ref.ref; const getBuildInfo = (filepath) => { - if (!fs__default["default"].existsSync(filepath)) { + if (!fs$1.existsSync(filepath)) { return false; } try { - return JSON.parse(fs__default["default"].readFileSync(filepath, 'utf8')); + return JSON.parse(fs$1.readFileSync(filepath, 'utf8')); } catch { return false; } }; -const isCloned = (workDir) => fs__default["default"].existsSync(path__default["default"].resolve(workDir, '.git')); +const isCloned = (workDir) => fs$1.existsSync(path$1.resolve(workDir, '.git')); const parseVersion = (version, options) => { // https://semver.org/spec/v2.0.0.html const regex = options?.strict ? @@ -88144,8 +88152,8 @@ const getArrayInput = (name, required = false, separator = ',', unique = true) = }; const sleep = async (millisecond) => new Promise(resolve => setTimeout(resolve, millisecond)); const useNpm = (workDir, pkgManager = '') => 'npm' === pkgManager || - ('yarn' !== pkgManager && (fs__default["default"].existsSync(path__default["default"].resolve(workDir, 'package-lock.json')) || - !fs__default["default"].existsSync(path__default["default"].resolve(workDir, 'yarn.lock')))); + ('yarn' !== pkgManager && (fs$1.existsSync(path$1.resolve(workDir, 'package-lock.json')) || + !fs$1.existsSync(path$1.resolve(workDir, 'yarn.lock')))); const replaceAll = (string, key, value) => string.split(key).join(value); const generateNewVersion = (lastTag, position) => { const parsed = parseVersion(lastTag); @@ -88299,7 +88307,7 @@ const getGitUrlAuthInfo = (token) => token ? `${getActor()}:${token}@` : ''; const getGitUrlWithToken = (context, token) => `https://${getGitUrlAuthInfo(token)}github.com/${context.repo.owner}/${context.repo.repo}.git`; const getGitUrl = (context, accessTokenRequired = true) => getGitUrlWithToken(context, getAccessToken(accessTokenRequired)); const showActionInfo = (rootDir, logger, context) => { - const info = getBuildInfo(path__default["default"].resolve(rootDir, 'build.json')); + const info = getBuildInfo(path$1.resolve(rootDir, 'build.json')); const tagName = getTagName(context); const separator = '=================================================='; logger.log(); @@ -88442,7 +88450,7 @@ class ApiHelper { value: async (rootDir, filepath) => { const blob = await this.octokit.rest.git.createBlob({ ...this.context.repo, - content: Buffer.from(fs__default["default"].readFileSync(path__default["default"].resolve(rootDir, filepath), 'utf8')).toString('base64'), + content: Buffer.from(fs$1.readFileSync(path$1.resolve(rootDir, filepath), 'utf8')).toString('base64'), encoding: 'base64', }); return { @@ -89162,10 +89170,10 @@ class GitHelper { if (isCloned(workDir) && !refresh) { return; } - if (fs__default["default"].existsSync(workDir)) { + if (fs$1.existsSync(workDir)) { await this.runCommand(workDir, { command: 'rm', args: ['-rdf', workDir] }); } - fs__default["default"].mkdirSync(workDir, { recursive: true }); + fs$1.mkdirSync(workDir, { recursive: true }); await this.runCommand(workDir, { command: 'git init', args: ['.'] }); } });