diff --git a/dist/index.js b/dist/index.js index e70c8f95..e72c2ec8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8 +1,7 @@ -module.exports = /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 7351: +/***/ 351: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -15,8 +14,8 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const os = __importStar(__nccwpck_require__(2087)); -const utils_1 = __nccwpck_require__(5278); +const os = __importStar(__nccwpck_require__(87)); +const utils_1 = __nccwpck_require__(278); /** * Commands * @@ -88,7 +87,7 @@ function escapeProperty(s) { /***/ }), -/***/ 2186: +/***/ 186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -110,11 +109,11 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const command_1 = __nccwpck_require__(7351); +const command_1 = __nccwpck_require__(351); const file_command_1 = __nccwpck_require__(717); -const utils_1 = __nccwpck_require__(5278); -const os = __importStar(__nccwpck_require__(2087)); -const path = __importStar(__nccwpck_require__(5622)); +const utils_1 = __nccwpck_require__(278); +const os = __importStar(__nccwpck_require__(87)); +const path = __importStar(__nccwpck_require__(622)); /** * The code to exit an action */ @@ -198,6 +197,7 @@ exports.getInput = getInput; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { + process.stdout.write(os.EOL); command_1.issueCommand('set-output', { name }, value); } exports.setOutput = setOutput; @@ -349,9 +349,9 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__nccwpck_require__(5747)); -const os = __importStar(__nccwpck_require__(2087)); -const utils_1 = __nccwpck_require__(5278); +const fs = __importStar(__nccwpck_require__(747)); +const os = __importStar(__nccwpck_require__(87)); +const utils_1 = __nccwpck_require__(278); function issueCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -369,7 +369,7 @@ exports.issueCommand = issueCommand; /***/ }), -/***/ 5278: +/***/ 278: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -395,7 +395,7 @@ exports.toCommandValue = toCommandValue; /***/ }), -/***/ 1514: +/***/ 514: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -417,7 +417,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const tr = __importStar(__nccwpck_require__(8159)); +const tr = __importStar(__nccwpck_require__(159)); /** * Exec a command. * Output will be streamed to the live console. @@ -446,7 +446,7 @@ exports.exec = exec; /***/ }), -/***/ 8159: +/***/ 159: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -468,12 +468,12 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const os = __importStar(__nccwpck_require__(2087)); -const events = __importStar(__nccwpck_require__(8614)); -const child = __importStar(__nccwpck_require__(3129)); -const path = __importStar(__nccwpck_require__(5622)); -const io = __importStar(__nccwpck_require__(7436)); -const ioUtil = __importStar(__nccwpck_require__(1962)); +const os = __importStar(__nccwpck_require__(87)); +const events = __importStar(__nccwpck_require__(614)); +const child = __importStar(__nccwpck_require__(129)); +const path = __importStar(__nccwpck_require__(622)); +const io = __importStar(__nccwpck_require__(436)); +const ioUtil = __importStar(__nccwpck_require__(962)); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -1053,15 +1053,15 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 4087: +/***/ 53: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Context = void 0; -const fs_1 = __nccwpck_require__(5747); -const os_1 = __nccwpck_require__(2087); +const fs_1 = __nccwpck_require__(747); +const os_1 = __nccwpck_require__(87); class Context { /** * Hydrate the context from the environment @@ -1110,7 +1110,7 @@ exports.Context = Context; /***/ }), -/***/ 5438: +/***/ 438: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1136,8 +1136,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokit = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(4087)); -const utils_1 = __nccwpck_require__(3030); +const Context = __importStar(__nccwpck_require__(53)); +const utils_1 = __nccwpck_require__(30); exports.context = new Context.Context(); /** * Returns a hydrated octokit ready to use for GitHub Actions @@ -1153,7 +1153,7 @@ exports.getOctokit = getOctokit; /***/ }), -/***/ 7914: +/***/ 914: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1179,7 +1179,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; -const httpClient = __importStar(__nccwpck_require__(9925)); +const httpClient = __importStar(__nccwpck_require__(925)); function getAuthString(token, options) { if (!token && !options.auth) { throw new Error('Parameter token or opts.auth is required'); @@ -1203,7 +1203,7 @@ exports.getApiBaseUrl = getApiBaseUrl; /***/ }), -/***/ 3030: +/***/ 30: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1229,12 +1229,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokitOptions = exports.GitHub = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(4087)); -const Utils = __importStar(__nccwpck_require__(7914)); +const Context = __importStar(__nccwpck_require__(53)); +const Utils = __importStar(__nccwpck_require__(914)); // octokit + plugins -const core_1 = __nccwpck_require__(6762); -const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044); -const plugin_paginate_rest_1 = __nccwpck_require__(4193); +const core_1 = __nccwpck_require__(762); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(44); +const plugin_paginate_rest_1 = __nccwpck_require__(193); exports.context = new Context.Context(); const baseUrl = Utils.getApiBaseUrl(); const defaults = { @@ -1264,15 +1264,15 @@ exports.getOctokitOptions = getOctokitOptions; /***/ }), -/***/ 9925: +/***/ 925: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -const http = __nccwpck_require__(8605); -const https = __nccwpck_require__(7211); -const pm = __nccwpck_require__(6443); +const http = __nccwpck_require__(605); +const https = __nccwpck_require__(211); +const pm = __nccwpck_require__(443); let tunnel; var HttpCodes; (function (HttpCodes) { @@ -1691,7 +1691,7 @@ class HttpClient { if (useProxy) { // If using proxy, need tunnel if (!tunnel) { - tunnel = __nccwpck_require__(4294); + tunnel = __nccwpck_require__(294); } const agentOptions = { maxSockets: maxSockets, @@ -1807,7 +1807,7 @@ exports.HttpClient = HttpClient; /***/ }), -/***/ 6443: +/***/ 443: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1872,7 +1872,7 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 1962: +/***/ 962: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1886,11 +1886,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +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; +}; var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); -const assert_1 = __nccwpck_require__(2357); -const fs = __nccwpck_require__(5747); -const path = __nccwpck_require__(5622); +const assert_1 = __nccwpck_require__(357); +const fs = __importStar(__nccwpck_require__(747)); +const path = __importStar(__nccwpck_require__(622)); _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; exports.IS_WINDOWS = process.platform === 'win32'; function exists(fsPath) { @@ -2074,7 +2081,7 @@ function isUnixExecutable(stats) { /***/ }), -/***/ 7436: +/***/ 436: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -2088,11 +2095,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +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 })); -const childProcess = __nccwpck_require__(3129); -const path = __nccwpck_require__(5622); -const util_1 = __nccwpck_require__(1669); -const ioUtil = __nccwpck_require__(1962); +const childProcess = __importStar(__nccwpck_require__(129)); +const path = __importStar(__nccwpck_require__(622)); +const util_1 = __nccwpck_require__(669); +const ioUtil = __importStar(__nccwpck_require__(962)); const exec = util_1.promisify(childProcess.exec); /** * Copies a file or folder. @@ -2260,58 +2274,73 @@ function which(tool, check) { throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); } } + return result; } - try { - // build the list of extensions to try - const extensions = []; - if (ioUtil.IS_WINDOWS && process.env.PATHEXT) { - for (const extension of process.env.PATHEXT.split(path.delimiter)) { - if (extension) { - extensions.push(extension); - } - } - } - // if it's rooted, return it if exists. otherwise return empty. - if (ioUtil.isRooted(tool)) { - const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); - if (filePath) { - return filePath; + const matches = yield findInPath(tool); + if (matches && matches.length > 0) { + return matches[0]; + } + return ''; + }); +} +exports.which = which; +/** + * Returns a list of all occurrences of the given tool on the system path. + * + * @returns Promise the paths of the tool + */ +function findInPath(tool) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + // build the list of extensions to try + const extensions = []; + if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) { + for (const extension of process.env['PATHEXT'].split(path.delimiter)) { + if (extension) { + extensions.push(extension); } - return ''; - } - // if any path separators, return empty - if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) { - return ''; } - // build the list of directories - // - // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, - // it feels like we should not do this. Checking the current directory seems like more of a use - // case of a shell, and the which() function exposed by the toolkit should strive for consistency - // across platforms. - const directories = []; - if (process.env.PATH) { - for (const p of process.env.PATH.split(path.delimiter)) { - if (p) { - directories.push(p); - } - } + } + // if it's rooted, return it if exists. otherwise return empty. + if (ioUtil.isRooted(tool)) { + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return [filePath]; } - // return the first match - for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); - if (filePath) { - return filePath; + return []; + } + // if any path separators, return empty + if (tool.includes(path.sep)) { + return []; + } + // build the list of directories + // + // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, + // it feels like we should not do this. Checking the current directory seems like more of a use + // case of a shell, and the which() function exposed by the toolkit should strive for consistency + // across platforms. + const directories = []; + if (process.env.PATH) { + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); } } - return ''; } - catch (err) { - throw new Error(`which failed with message ${err.message}`); + // find all matches + const matches = []; + for (const directory of directories) { + const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); + if (filePath) { + matches.push(filePath); + } } + return matches; }); } -exports.which = which; +exports.findInPath = findInPath; function readCopyOptions(options) { const force = options.force == null ? true : options.force; const recursive = Boolean(options.recursive); @@ -2428,7 +2457,7 @@ exports.createTokenAuth = createTokenAuth; /***/ }), -/***/ 6762: +/***/ 762: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -2436,10 +2465,10 @@ exports.createTokenAuth = createTokenAuth; Object.defineProperty(exports, "__esModule", ({ value: true })); -var universalUserAgent = __nccwpck_require__(5030); -var beforeAfterHook = __nccwpck_require__(3682); -var request = __nccwpck_require__(6234); -var graphql = __nccwpck_require__(8467); +var universalUserAgent = __nccwpck_require__(429); +var beforeAfterHook = __nccwpck_require__(682); +var request = __nccwpck_require__(234); +var graphql = __nccwpck_require__(668); var authToken = __nccwpck_require__(334); function _objectWithoutPropertiesLoose(source, excluded) { @@ -2610,7 +2639,7 @@ exports.Octokit = Octokit; /***/ }), -/***/ 9440: +/***/ 440: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -2618,8 +2647,8 @@ exports.Octokit = Octokit; Object.defineProperty(exports, "__esModule", ({ value: true })); -var isPlainObject = __nccwpck_require__(3287); -var universalUserAgent = __nccwpck_require__(5030); +var isPlainObject = __nccwpck_require__(287); +var universalUserAgent = __nccwpck_require__(429); function lowercaseKeys(object) { if (!object) { @@ -3008,7 +3037,7 @@ exports.endpoint = endpoint; /***/ }), -/***/ 8467: +/***/ 668: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -3016,8 +3045,8 @@ exports.endpoint = endpoint; Object.defineProperty(exports, "__esModule", ({ value: true })); -var request = __nccwpck_require__(6234); -var universalUserAgent = __nccwpck_require__(5030); +var request = __nccwpck_require__(234); +var universalUserAgent = __nccwpck_require__(429); const VERSION = "4.6.0"; @@ -3124,7 +3153,7 @@ exports.withCustomRequest = withCustomRequest; /***/ }), -/***/ 4193: +/***/ 193: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -3264,7 +3293,7 @@ exports.paginateRest = paginateRest; /***/ }), -/***/ 3044: +/***/ 44: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -4440,8 +4469,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var deprecation = __nccwpck_require__(8932); -var once = _interopDefault(__nccwpck_require__(1223)); +var deprecation = __nccwpck_require__(932); +var once = _interopDefault(__nccwpck_require__(223)); const logOnce = once(deprecation => console.warn(deprecation)); /** @@ -4493,7 +4522,7 @@ exports.RequestError = RequestError; /***/ }), -/***/ 6234: +/***/ 234: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -4503,9 +4532,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var endpoint = __nccwpck_require__(9440); -var universalUserAgent = __nccwpck_require__(5030); -var isPlainObject = __nccwpck_require__(3287); +var endpoint = __nccwpck_require__(440); +var universalUserAgent = __nccwpck_require__(429); +var isPlainObject = __nccwpck_require__(287); var nodeFetch = _interopDefault(__nccwpck_require__(467)); var requestError = __nccwpck_require__(537); @@ -4649,12 +4678,12 @@ exports.request = request; /***/ }), -/***/ 3682: +/***/ 682: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var register = __nccwpck_require__(4670) -var addHook = __nccwpck_require__(5549) -var removeHook = __nccwpck_require__(6819) +var register = __nccwpck_require__(670) +var addHook = __nccwpck_require__(549) +var removeHook = __nccwpck_require__(819) // bind with array of arguments: https://stackoverflow.com/a/21792913 var bind = Function.bind @@ -4713,7 +4742,7 @@ module.exports.Collection = Hook.Collection /***/ }), -/***/ 5549: +/***/ 549: /***/ ((module) => { module.exports = addHook; @@ -4766,7 +4795,7 @@ function addHook(state, kind, name, hook) { /***/ }), -/***/ 4670: +/***/ 670: /***/ ((module) => { module.exports = register; @@ -4800,7 +4829,7 @@ function register(state, name, method, options) { /***/ }), -/***/ 6819: +/***/ 819: /***/ ((module) => { module.exports = removeHook; @@ -4826,7 +4855,7 @@ function removeHook(state, name, method) { /***/ }), -/***/ 8932: +/***/ 932: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -4854,7 +4883,7 @@ exports.Deprecation = Deprecation; /***/ }), -/***/ 3287: +/***/ 287: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -4910,11 +4939,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var Stream = _interopDefault(__nccwpck_require__(2413)); -var http = _interopDefault(__nccwpck_require__(8605)); -var Url = _interopDefault(__nccwpck_require__(8835)); -var https = _interopDefault(__nccwpck_require__(7211)); -var zlib = _interopDefault(__nccwpck_require__(8761)); +var Stream = _interopDefault(__nccwpck_require__(413)); +var http = _interopDefault(__nccwpck_require__(605)); +var Url = _interopDefault(__nccwpck_require__(835)); +var https = _interopDefault(__nccwpck_require__(211)); +var zlib = _interopDefault(__nccwpck_require__(761)); // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js @@ -5065,7 +5094,7 @@ FetchError.prototype.name = 'FetchError'; let convert; try { - convert = __nccwpck_require__(2877).convert; + convert = __nccwpck_require__(877).convert; } catch (e) {} const INTERNALS = Symbol('Body internals'); @@ -6557,10 +6586,10 @@ exports.FetchError = FetchError; /***/ }), -/***/ 1223: +/***/ 223: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var wrappy = __nccwpck_require__(2940) +var wrappy = __nccwpck_require__(940) module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -6606,27 +6635,27 @@ function onceStrict (fn) { /***/ }), -/***/ 4294: +/***/ 294: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(4219); +module.exports = __nccwpck_require__(219); /***/ }), -/***/ 4219: +/***/ 219: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var net = __nccwpck_require__(1631); -var tls = __nccwpck_require__(4016); -var http = __nccwpck_require__(8605); -var https = __nccwpck_require__(7211); -var events = __nccwpck_require__(8614); -var assert = __nccwpck_require__(2357); -var util = __nccwpck_require__(1669); +var net = __nccwpck_require__(631); +var tls = __nccwpck_require__(16); +var http = __nccwpck_require__(605); +var https = __nccwpck_require__(211); +var events = __nccwpck_require__(614); +var assert = __nccwpck_require__(357); +var util = __nccwpck_require__(669); exports.httpOverHttp = httpOverHttp; @@ -6886,7 +6915,7 @@ exports.debug = debug; // for test /***/ }), -/***/ 5030: +/***/ 429: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -6912,7 +6941,7 @@ exports.getUserAgent = getUserAgent; /***/ }), -/***/ 2940: +/***/ 940: /***/ ((module) => { // Returns a wrapper function that returns a wrapped callback @@ -6952,205 +6981,7 @@ function wrappy (fn, cb) { /***/ }), -/***/ 7014: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -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) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.fix = exports.check = void 0; -const core_1 = __nccwpck_require__(2186); -const dotnet_1 = __nccwpck_require__(9870); -function check() { - return __awaiter(this, void 0, void 0, function* () { - const onlyChangedFiles = core_1.getInput("only-changed-files") === "true"; - const failFast = core_1.getInput("fail-fast") === "true"; - const result = yield dotnet_1.format({ - dryRun: true, - onlyChangedFiles, - }); - core_1.setOutput("has-changes", result.toString()); - // fail fast will cause the workflow to stop on this job - if (result && failFast) { - throw Error("Formatting issues found"); - } - }); -} -exports.check = check; -function fix() { - return __awaiter(this, void 0, void 0, function* () { - const onlyChangedFiles = core_1.getInput("only-changed-files") === "true"; - const result = yield dotnet_1.format({ - dryRun: false, - onlyChangedFiles, - }); - core_1.setOutput("has-changes", result.toString()); - }); -} -exports.fix = fix; - - -/***/ }), - -/***/ 9870: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -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) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.format = void 0; -const core_1 = __nccwpck_require__(2186); -const exec_1 = __nccwpck_require__(1514); -const github_1 = __nccwpck_require__(5438); -const io_1 = __nccwpck_require__(7436); -const files_1 = __nccwpck_require__(7255); -function formatOnlyChangedFiles(onlyChangedFiles) { - if (onlyChangedFiles) { - if (github_1.context.eventName === "issue_comment" || github_1.context.eventName === "pull_request") { - return true; - } - core_1.warning("Formatting only changed files is available on the issue_comment and pull_request events only"); - return false; - } - return false; -} -function format(options) { - return __awaiter(this, void 0, void 0, function* () { - const execOptions = { ignoreReturnCode: true }; - const dotnetFormatOptions = ["format", "--check"]; - if (options.dryRun) { - dotnetFormatOptions.push("--dry-run"); - } - if (formatOnlyChangedFiles(options.onlyChangedFiles)) { - const filesToCheck = yield files_1.getPullRequestFiles(); - core_1.info(`Checking ${filesToCheck.length} files`); - // if there weren't any files to check then we need to bail - if (!filesToCheck.length) { - core_1.debug("No files found for formatting"); - return false; - } - dotnetFormatOptions.push("--files", filesToCheck.join(",")); - } - const dotnetPath = yield io_1.which("dotnet", true); - const dotnetResult = yield exec_1.exec(`"${dotnetPath}"`, dotnetFormatOptions, execOptions); - return !!dotnetResult; - }); -} -exports.format = format; - - -/***/ }), - -/***/ 7255: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -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) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getPullRequestFiles = void 0; -const path_1 = __nccwpck_require__(5622); -const core_1 = __nccwpck_require__(2186); -const github_1 = __nccwpck_require__(5438); -const fileTypes = [ - ".cs", - ".vb", -]; -function getPullRequestFiles() { - return __awaiter(this, void 0, void 0, function* () { - const token = core_1.getInput("repo-token", { required: true }); - const githubClient = github_1.getOctokit(token); - if (!github_1.context.issue.number) { - throw Error("Unable to get pull request number from action event"); - } - const files = yield githubClient.paginate(githubClient.pulls.listFiles, Object.assign(Object.assign({}, github_1.context.repo), { pull_number: github_1.context.issue.number })); - return files - .filter((file) => file.status !== "removed" /* Removed */) - .filter((file) => fileTypes.includes(path_1.extname(file.filename))) - .map((file) => file.filename); - }); -} -exports.getPullRequestFiles = getPullRequestFiles; - - -/***/ }), - -/***/ 399: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -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) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.run = void 0; -const core_1 = __nccwpck_require__(2186); -const actions_1 = __nccwpck_require__(7014); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - const action = core_1.getInput("action", { required: true }); - switch (action) { - case "check": - yield actions_1.check(); - break; - case "fix": - yield actions_1.fix(); - break; - default: - throw Error(`Unsupported action "${action}"`); - } - } - catch (error) { - if (error instanceof Error) { - core_1.setFailed(error.message); - } - else { - throw error; - } - } - }); -} -exports.run = run; -void run(); - - -/***/ }), - -/***/ 2877: +/***/ 877: /***/ ((module) => { module.exports = eval("require")("encoding"); @@ -7158,7 +6989,7 @@ module.exports = eval("require")("encoding"); /***/ }), -/***/ 2357: +/***/ 357: /***/ ((module) => { "use strict"; @@ -7166,7 +6997,7 @@ module.exports = require("assert");; /***/ }), -/***/ 3129: +/***/ 129: /***/ ((module) => { "use strict"; @@ -7174,7 +7005,7 @@ module.exports = require("child_process");; /***/ }), -/***/ 8614: +/***/ 614: /***/ ((module) => { "use strict"; @@ -7182,7 +7013,7 @@ module.exports = require("events");; /***/ }), -/***/ 5747: +/***/ 747: /***/ ((module) => { "use strict"; @@ -7190,7 +7021,7 @@ module.exports = require("fs");; /***/ }), -/***/ 8605: +/***/ 605: /***/ ((module) => { "use strict"; @@ -7198,7 +7029,7 @@ module.exports = require("http");; /***/ }), -/***/ 7211: +/***/ 211: /***/ ((module) => { "use strict"; @@ -7206,7 +7037,7 @@ module.exports = require("https");; /***/ }), -/***/ 1631: +/***/ 631: /***/ ((module) => { "use strict"; @@ -7214,7 +7045,7 @@ module.exports = require("net");; /***/ }), -/***/ 2087: +/***/ 87: /***/ ((module) => { "use strict"; @@ -7222,7 +7053,7 @@ module.exports = require("os");; /***/ }), -/***/ 5622: +/***/ 622: /***/ ((module) => { "use strict"; @@ -7230,7 +7061,7 @@ module.exports = require("path");; /***/ }), -/***/ 2413: +/***/ 413: /***/ ((module) => { "use strict"; @@ -7238,7 +7069,7 @@ module.exports = require("stream");; /***/ }), -/***/ 4016: +/***/ 16: /***/ ((module) => { "use strict"; @@ -7246,7 +7077,7 @@ module.exports = require("tls");; /***/ }), -/***/ 8835: +/***/ 835: /***/ ((module) => { "use strict"; @@ -7254,7 +7085,7 @@ module.exports = require("url");; /***/ }), -/***/ 1669: +/***/ 669: /***/ ((module) => { "use strict"; @@ -7262,7 +7093,7 @@ module.exports = require("util");; /***/ }), -/***/ 8761: +/***/ 761: /***/ ((module) => { "use strict"; @@ -7278,8 +7109,9 @@ module.exports = require("zlib");; /******/ // The require function /******/ function __nccwpck_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -7302,12 +7134,202 @@ module.exports = require("zlib");; /******/ } /******/ /************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __nccwpck_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __nccwpck_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/compat */ /******/ -/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled -/******/ // startup -/******/ // Load entry module and return exports -/******/ return __nccwpck_require__(399); +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +// ESM COMPAT FLAG +__nccwpck_require__.r(__webpack_exports__); + +// EXPORTS +__nccwpck_require__.d(__webpack_exports__, { + "run": () => (/* binding */ run) +}); + +// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js +var core = __nccwpck_require__(186); +// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js +var exec = __nccwpck_require__(514); +// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js +var github = __nccwpck_require__(438); +// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js +var io = __nccwpck_require__(436); +// EXTERNAL MODULE: external "path" +var external_path_ = __nccwpck_require__(622); +;// CONCATENATED MODULE: ./src/files.ts + + + +const fileTypes = [ + ".cs", + ".vb", +]; +async function getPullRequestFiles() { + const token = (0,core.getInput)("repo-token", { required: true }); + const githubClient = (0,github.getOctokit)(token); + if (!github.context.issue.number) { + throw Error("Unable to get pull request number from action event"); + } + const files = await githubClient.paginate(githubClient.pulls.listFiles, { + ...github.context.repo, + pull_number: github.context.issue.number, + }); + return files + .filter((file) => file.status !== "removed" /* Removed */) + .filter((file) => fileTypes.includes((0,external_path_.extname)(file.filename))) + .map((file) => file.filename); +} + +;// CONCATENATED MODULE: ./src/dotnet.ts + + + + + +function formatOnlyChangedFiles(onlyChangedFiles) { + if (onlyChangedFiles) { + if (github.context.eventName === "issue_comment" || github.context.eventName === "pull_request") { + return true; + } + (0,core.warning)("Formatting only changed files is available on the issue_comment and pull_request events only"); + return false; + } + return false; +} +async function formatVersion3(options) { + const execOptions = { ignoreReturnCode: true }; + const dotnetFormatOptions = ["format", "--check"]; + if (options.dryRun) { + dotnetFormatOptions.push("--dry-run"); + } + if (formatOnlyChangedFiles(options.onlyChangedFiles)) { + const filesToCheck = await getPullRequestFiles(); + (0,core.info)(`Checking ${filesToCheck.length} files`); + // if there weren't any files to check then we need to bail + if (!filesToCheck.length) { + (0,core.debug)("No files found for formatting"); + return false; + } + dotnetFormatOptions.push("--files", filesToCheck.join(",")); + } + const dotnetPath = await (0,io.which)("dotnet", true); + const dotnetResult = await (0,exec.exec)(`"${dotnetPath}"`, dotnetFormatOptions, execOptions); + return !!dotnetResult; +} +function format(version) { + switch (version || "") { + case "3": + return formatVersion3; + default: + throw Error(`dotnet-format version "${version}" is unsupported`); + } +} + +;// CONCATENATED MODULE: ./src/version.ts +const supportedVersions = [ + "3", +]; +function checkVersion(version) { + for (let i = 0; i < supportedVersions.length; i++) { + const ver = supportedVersions[i]; + if (ver === version) { + return version; + } + } + throw Error(`dotnet-format version "${version}" is unsupported`); +} + +;// CONCATENATED MODULE: ./src/actions.ts + + + +async function check() { + const onlyChangedFiles = (0,core.getInput)("only-changed-files") === "true"; + const failFast = (0,core.getInput)("fail-fast") === "true"; + const version = (0,core.getInput)("version", { required: true }); + const dotnetFormatVersion = checkVersion(version); + const result = await format(dotnetFormatVersion)({ + dryRun: true, + onlyChangedFiles, + }); + (0,core.setOutput)("has-changes", result.toString()); + // fail fast will cause the workflow to stop on this job + if (result && failFast) { + throw Error("Formatting issues found"); + } +} +async function fix() { + const onlyChangedFiles = (0,core.getInput)("only-changed-files") === "true"; + const version = (0,core.getInput)("version", { required: true }); + const dotnetFormatVersion = checkVersion(version); + const result = await format(dotnetFormatVersion)({ + dryRun: false, + onlyChangedFiles, + }); + (0,core.setOutput)("has-changes", result.toString()); +} + +;// CONCATENATED MODULE: ./src/main.ts + + +async function run() { + try { + const action = (0,core.getInput)("action", { required: true }); + switch (action) { + case "check": + await check(); + break; + case "fix": + await fix(); + break; + default: + throw Error(`Unsupported action "${action}"`); + } + } + catch (error) { + if (error instanceof Error) { + (0,core.setFailed)(error.message); + } + else { + throw error; + } + } +} +void run(); + +})(); + +module.exports = __webpack_exports__; /******/ })() ; \ No newline at end of file