diff --git a/README.md b/README.md index 072abd3..4cb2295 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ jobs: | `pack-size-threshold` | Threshold (in bytes) for warning about significant increase in total pack size | No | `50000` | | `detect-replacements` | Detect modules which have community suggested alternatives | No | `true` | | `working-directory` | Working directory to scan for package lock file | No | None | +| `mode` | Run mode: `comment`, `artifact`, or `comment-from-artifact` | No | `comment` | +| `artifact-path` | Path to the artifact JSON file (for `comment-from-artifact` mode) | No | None | ## Example with custom inputs @@ -66,7 +68,8 @@ jobs: See the [`recipes/`](./recipes/) directory for complete workflow examples: -- [`basic.yml`](./recipes/basic.yml) - Basic dependency diff on pull requests +- [`basic/`](./recipes/basic/) - Basic dependency diff on pull requests +- [`artifact/`](./recipes/artifact/) - Two-workflow setup using artifacts (no `pull_request_target` needed) - [`bundle-diff.yml`](./recipes/bundle-diff.yml) - Advanced workflow with package bundle size analysis ## Always Report Install Size @@ -126,6 +129,32 @@ permissions: pull-requests: write # To comment on pull requests ``` +## Artifact Mode + +By default, the action posts a comment directly to the pull request. This requires `pull-requests: write` permission in the workflow that runs the analysis, which typically means using `pull_request_target` for fork PRs. + +If you'd prefer not to use `pull_request_target`, you can use a two-workflow setup with artifact mode: + +1. **Analyze workflow** (`pull_request`) - runs the analysis and uploads the result as an artifact: + +```yaml +- name: Analyze Dependencies + uses: e18e/action-dependency-diff@v1 + with: + mode: artifact +``` + +2. **Comment workflow** (`workflow_run`) - downloads the artifact and posts the comment: + +```yaml +- name: Post Comment + uses: e18e/action-dependency-diff@v1 + with: + mode: comment-from-artifact +``` + +See the [`recipes/artifact/`](./recipes/artifact/) directory for complete workflow files. + ## Trust levels of packages The following levels are considered when evaluating package trust: diff --git a/action.yml b/action.yml index 9c4c9b4..190a36e 100644 --- a/action.yml +++ b/action.yml @@ -47,6 +47,17 @@ inputs: working-directory: description: 'Working directory to scan for package lock file' required: false + mode: + description: 'Run mode. "comment" posts a PR comment directly, "artifact" writes a JSON file containing the comment body and PR number, "comment-from-artifact" reads a previously written artifact file and posts it as a PR comment.' + required: false + default: 'comment' + artifact-path: + description: 'Path to the artifact JSON file. Required when mode is "comment-from-artifact".' + required: false + +outputs: + artifact-path: + description: 'Path to the artifact JSON file. Set when mode is "artifact".' runs: using: node24 diff --git a/build/main.js b/build/main.js index 32977a9..d8fbc99 100644 --- a/build/main.js +++ b/build/main.js @@ -33,287 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge mod )); -// node_modules/@actions/core/lib/utils.js -var require_utils = __commonJS({ - "node_modules/@actions/core/lib/utils.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.toCommandValue = toCommandValue; - exports.toCommandProperties = toCommandProperties; - function toCommandValue(input) { - if (input === null || input === void 0) { - return ""; - } else if (typeof input === "string" || input instanceof String) { - return input; - } - return JSON.stringify(input); - } - function toCommandProperties(annotationProperties) { - if (!Object.keys(annotationProperties).length) { - return {}; - } - return { - title: annotationProperties.title, - file: annotationProperties.file, - line: annotationProperties.startLine, - endLine: annotationProperties.endLine, - col: annotationProperties.startColumn, - endColumn: annotationProperties.endColumn - }; - } - } -}); - -// node_modules/@actions/core/lib/command.js -var require_command = __commonJS({ - "node_modules/@actions/core/lib/command.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.issueCommand = issueCommand; - exports.issue = issue; - var os = __importStar(__require("os")); - var utils_1 = require_utils(); - function issueCommand(command, properties, message) { - const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); - } - function issue(name, message = "") { - issueCommand(name, {}, message); - } - var CMD_STRING = "::"; - var Command = class { - constructor(command, properties, message) { - if (!command) { - command = "missing.command"; - } - this.command = command; - this.properties = properties; - this.message = message; - } - toString() { - let cmdStr = CMD_STRING + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += " "; - let first = true; - for (const key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - const val = this.properties[key]; - if (val) { - if (first) { - first = false; - } else { - cmdStr += ","; - } - cmdStr += `${key}=${escapeProperty(val)}`; - } - } - } - } - cmdStr += `${CMD_STRING}${escapeData(this.message)}`; - return cmdStr; - } - }; - function escapeData(s) { - return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); - } - function escapeProperty(s) { - return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); - } - } -}); - -// node_modules/@actions/core/lib/file-command.js -var require_file_command = __commonJS({ - "node_modules/@actions/core/lib/file-command.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.issueFileCommand = issueFileCommand; - exports.prepareKeyValueMessage = prepareKeyValueMessage; - var crypto = __importStar(__require("crypto")); - var fs2 = __importStar(__require("fs")); - var os = __importStar(__require("os")); - var utils_1 = require_utils(); - 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, `${(0, utils_1.toCommandValue)(message)}${os.EOL}`, { - encoding: "utf8" - }); - } - function prepareKeyValueMessage(key, value) { - const delimiter = `ghadelimiter_${crypto.randomUUID()}`; - const convertedValue = (0, 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}`; - } - } -}); - -// node_modules/@actions/http-client/lib/proxy.js -var require_proxy = __commonJS({ - "node_modules/@actions/http-client/lib/proxy.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getProxyUrl = getProxyUrl; - exports.checkBypass = checkBypass; - function getProxyUrl(reqUrl) { - const usingSsl = reqUrl.protocol === "https:"; - if (checkBypass(reqUrl)) { - return void 0; - } - const proxyVar = (() => { - if (usingSsl) { - return process.env["https_proxy"] || process.env["HTTPS_PROXY"]; - } else { - return process.env["http_proxy"] || process.env["HTTP_PROXY"]; - } - })(); - if (proxyVar) { - try { - return new DecodedURL(proxyVar); - } catch (_a) { - if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://")) - return new DecodedURL(`http://${proxyVar}`); - } - } else { - return void 0; - } - } - function checkBypass(reqUrl) { - if (!reqUrl.hostname) { - return false; - } - const reqHost = reqUrl.hostname; - if (isLoopbackAddress(reqHost)) { - return true; - } - const noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || ""; - if (!noProxy) { - return false; - } - let reqPort; - if (reqUrl.port) { - reqPort = Number(reqUrl.port); - } else if (reqUrl.protocol === "http:") { - reqPort = 80; - } else if (reqUrl.protocol === "https:") { - reqPort = 443; - } - const upperReqHosts = [reqUrl.hostname.toUpperCase()]; - if (typeof reqPort === "number") { - upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); - } - for (const upperNoProxyItem of noProxy.split(",").map((x) => x.trim().toUpperCase()).filter((x) => x)) { - if (upperNoProxyItem === "*" || upperReqHosts.some((x) => x === upperNoProxyItem || x.endsWith(`.${upperNoProxyItem}`) || upperNoProxyItem.startsWith(".") && x.endsWith(`${upperNoProxyItem}`))) { - return true; - } - } - return false; - } - function isLoopbackAddress(host) { - const hostLower = host.toLowerCase(); - return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]"); - } - var DecodedURL = class extends URL { - constructor(url, base) { - super(url, base); - this._decodedUsername = decodeURIComponent(super.username); - this._decodedPassword = decodeURIComponent(super.password); - } - get username() { - return this._decodedUsername; - } - get password() { - return this._decodedPassword; - } - }; - } -}); - // node_modules/tunnel/lib/tunnel.js var require_tunnel = __commonJS({ "node_modules/tunnel/lib/tunnel.js"(exports) { @@ -325,28 +44,28 @@ var require_tunnel = __commonJS({ var events = __require("events"); var assert = __require("assert"); var util = __require("util"); - exports.httpOverHttp = httpOverHttp; - exports.httpsOverHttp = httpsOverHttp; - exports.httpOverHttps = httpOverHttps; - exports.httpsOverHttps = httpsOverHttps; - function httpOverHttp(options) { + exports.httpOverHttp = httpOverHttp2; + exports.httpsOverHttp = httpsOverHttp2; + exports.httpOverHttps = httpOverHttps2; + exports.httpsOverHttps = httpsOverHttps2; + function httpOverHttp2(options) { var agent = new TunnelingAgent(options); agent.request = http.request; return agent; } - function httpsOverHttp(options) { + function httpsOverHttp2(options) { var agent = new TunnelingAgent(options); agent.request = http.request; agent.createSocket = createSecureSocket; agent.defaultPort = 443; return agent; } - function httpOverHttps(options) { + function httpOverHttps2(options) { var agent = new TunnelingAgent(options); agent.request = https.request; return agent; } - function httpsOverHttps(options) { + function httpsOverHttps2(options) { var agent = new TunnelingAgent(options); agent.request = https.request; agent.createSocket = createSecureSocket; @@ -417,7 +136,7 @@ var require_tunnel = __commonJS({ connectOptions.headers = connectOptions.headers || {}; connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64"); } - debug("making CONNECT request"); + debug2("making CONNECT request"); var connectReq = self.request(connectOptions); connectReq.useChunkedEncodingByDefault = false; connectReq.once("response", onResponse); @@ -437,40 +156,40 @@ var require_tunnel = __commonJS({ connectReq.removeAllListeners(); socket.removeAllListeners(); if (res.statusCode !== 200) { - debug( + debug2( "tunneling socket could not be established, statusCode=%d", res.statusCode ); socket.destroy(); - var error3 = new Error("tunneling socket could not be established, statusCode=" + res.statusCode); - error3.code = "ECONNRESET"; - options.request.emit("error", error3); + var error2 = new Error("tunneling socket could not be established, statusCode=" + res.statusCode); + error2.code = "ECONNRESET"; + options.request.emit("error", error2); self.removeSocket(placeholder); return; } if (head.length > 0) { - debug("got illegal response body from proxy"); + debug2("got illegal response body from proxy"); socket.destroy(); - var error3 = new Error("got illegal response body from proxy"); - error3.code = "ECONNRESET"; - options.request.emit("error", error3); + var error2 = new Error("got illegal response body from proxy"); + error2.code = "ECONNRESET"; + options.request.emit("error", error2); self.removeSocket(placeholder); return; } - debug("tunneling connection has established"); + debug2("tunneling connection has established"); self.sockets[self.sockets.indexOf(placeholder)] = socket; return cb(socket); } function onError(cause) { connectReq.removeAllListeners(); - debug( + debug2( "tunneling socket could not be established, cause=%s\n", cause.message, cause.stack ); - var error3 = new Error("tunneling socket could not be established, cause=" + cause.message); - error3.code = "ECONNRESET"; - options.request.emit("error", error3); + var error2 = new Error("tunneling socket could not be established, cause=" + cause.message); + error2.code = "ECONNRESET"; + options.request.emit("error", error2); self.removeSocket(placeholder); } }; @@ -525,9 +244,9 @@ var require_tunnel = __commonJS({ } return target; } - var debug; + var debug2; if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { + debug2 = function() { var args = Array.prototype.slice.call(arguments); if (typeof args[0] === "string") { args[0] = "TUNNEL: " + args[0]; @@ -537,10 +256,10 @@ var require_tunnel = __commonJS({ console.error.apply(console, args); }; } else { - debug = function() { + debug2 = function() { }; } - exports.debug = debug; + exports.debug = debug2; } }); @@ -1783,14 +1502,14 @@ var require_diagnostics = __commonJS({ diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { connectParams: { version, protocol, port, host }, - error: error3 + error: error2 } = evt; debuglog( "connection to %s using %s%s errored - %s", `${host}${port ? `:${port}` : ""}`, protocol, version, - error3.message + error2.message ); }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { @@ -1821,14 +1540,14 @@ var require_diagnostics = __commonJS({ diagnosticsChannel.channel("undici:request:error").subscribe((evt) => { const { request: { method, path: path2, origin }, - error: error3 + error: error2 } = evt; debuglog( "request to %s %s/%s errored - %s", method, origin, path2, - error3.message + error2.message ); }); isClientSet = true; @@ -1863,7 +1582,7 @@ var require_diagnostics = __commonJS({ diagnosticsChannel.channel("undici:client:connectError").subscribe((evt) => { const { connectParams: { version, protocol, port, host }, - error: error3 + error: error2 } = evt; debuglog( "connection to %s%s using %s%s errored - %s", @@ -1871,7 +1590,7 @@ var require_diagnostics = __commonJS({ port ? `:${port}` : "", protocol, version, - error3.message + error2.message ); }); diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => { @@ -2138,16 +1857,16 @@ var require_request = __commonJS({ this.onError(err); } } - onError(error3) { + onError(error2) { this.onFinally(); if (channels.error.hasSubscribers) { - channels.error.publish({ request: this, error: error3 }); + channels.error.publish({ request: this, error: error2 }); } if (this.aborted) { return; } this.aborted = true; - return this[kHandler].onError(error3); + return this[kHandler].onError(error2); } onFinally() { if (this.errorHandler) { @@ -2864,7 +2583,7 @@ var require_connect = __commonJS({ }); // node_modules/undici/lib/llhttp/utils.js -var require_utils2 = __commonJS({ +var require_utils = __commonJS({ "node_modules/undici/lib/llhttp/utils.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -2889,7 +2608,7 @@ var require_constants2 = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0; - var utils_1 = require_utils2(); + var utils_1 = require_utils(); var ERROR; (function(ERROR2) { ERROR2[ERROR2["OK"] = 0] = "OK"; @@ -4262,11 +3981,11 @@ var require_util2 = __commonJS({ var { isUint8Array } = __require("node:util/types"); var { webidl } = require_webidl(); var supportedHashes = []; - var crypto; + var crypto2; try { - crypto = __require("node:crypto"); + crypto2 = __require("node:crypto"); const possibleRelevantHashes = ["sha256", "sha384", "sha512"]; - supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); + supportedHashes = crypto2.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)); } catch { } function responseURL(response) { @@ -4539,7 +4258,7 @@ var require_util2 = __commonJS({ } } function bytesMatch(bytes, metadataList) { - if (crypto === void 0) { + if (crypto2 === void 0) { return true; } const parsedMetadata = parseMetadata(metadataList); @@ -4554,7 +4273,7 @@ var require_util2 = __commonJS({ for (const item of metadata) { const algorithm = item.algo; const expectedValue = item.hash; - let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64"); + let actualValue = crypto2.createHash(algorithm).update(bytes).digest("base64"); if (actualValue[actualValue.length - 1] === "=") { if (actualValue[actualValue.length - 2] === "=") { actualValue = actualValue.slice(0, -2); @@ -5618,8 +5337,8 @@ var require_body = __commonJS({ var { multipartFormDataParser } = require_formdata_parser(); var random; try { - const crypto = __require("node:crypto"); - random = (max) => crypto.randomInt(0, max); + const crypto2 = __require("node:crypto"); + random = (max) => crypto2.randomInt(0, max); } catch { random = (max) => Math.floor(Math.random(max)); } @@ -5864,7 +5583,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r } throwIfAborted(object[kState]); const promise = createDeferredPromise(); - const errorSteps = (error3) => promise.reject(error3); + const errorSteps = (error2) => promise.reject(error2); const successSteps = (data) => { try { promise.resolve(convertBytesToJSValue(data)); @@ -5959,7 +5678,7 @@ var require_client_h1 = __commonJS({ kResume, kHTTPContext } = require_symbols(); - var constants = require_constants2(); + var constants3 = require_constants2(); var EMPTY_BUF = Buffer.alloc(0); var FastBuffer = Buffer[Symbol.species]; var addListener = util.addListener; @@ -6031,7 +5750,7 @@ var require_client_h1 = __commonJS({ constructor(client, socket, { exports: exports2 }) { assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0); this.llhttp = exports2; - this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE); + this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE); this.client = client; this.socket = socket; this.timeout = null; @@ -6126,19 +5845,19 @@ var require_client_h1 = __commonJS({ currentBufferRef = null; } const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr; - if (ret === constants.ERROR.PAUSED_UPGRADE) { + if (ret === constants3.ERROR.PAUSED_UPGRADE) { this.onUpgrade(data.slice(offset)); - } else if (ret === constants.ERROR.PAUSED) { + } else if (ret === constants3.ERROR.PAUSED) { this.paused = true; socket.unshift(data.slice(offset)); - } else if (ret !== constants.ERROR.OK) { + } else if (ret !== constants3.ERROR.OK) { const ptr = llhttp.llhttp_get_error_reason(this.ptr); let message = ""; if (ptr) { const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0); message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")"; } - throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)); + throw new HTTPParserError(message, constants3.ERROR[ret], data.slice(offset)); } } catch (err) { util.destroy(socket, err); @@ -6313,7 +6032,7 @@ var require_client_h1 = __commonJS({ socket[kBlocking] = false; client[kResume](); } - return pause ? constants.ERROR.PAUSED : 0; + return pause ? constants3.ERROR.PAUSED : 0; } onBody(buf) { const { client, socket, statusCode, maxResponseSize } = this; @@ -6335,7 +6054,7 @@ var require_client_h1 = __commonJS({ } this.bytesRead += buf.length; if (request2.onData(buf) === false) { - return constants.ERROR.PAUSED; + return constants3.ERROR.PAUSED; } } onMessageComplete() { @@ -6370,13 +6089,13 @@ var require_client_h1 = __commonJS({ if (socket[kWriting]) { assert(client[kRunning] === 0); util.destroy(socket, new InformationalError("reset")); - return constants.ERROR.PAUSED; + return constants3.ERROR.PAUSED; } else if (!shouldKeepAlive) { util.destroy(socket, new InformationalError("reset")); - return constants.ERROR.PAUSED; + return constants3.ERROR.PAUSED; } else if (socket[kReset] && client[kRunning] === 0) { util.destroy(socket, new InformationalError("reset")); - return constants.ERROR.PAUSED; + return constants3.ERROR.PAUSED; } else if (client[kPipelining] == null || client[kPipelining] === 1) { setImmediate(() => client[kResume]()); } else { @@ -7372,8 +7091,8 @@ var require_client_h2 = __commonJS({ } request2.onRequestSent(); client[kResume](); - } catch (error3) { - abort(error3); + } catch (error2) { + abort(error2); } } function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) { @@ -7528,8 +7247,8 @@ var require_redirect_handler = __commonJS({ onUpgrade(statusCode, headers, socket) { this.handler.onUpgrade(statusCode, headers, socket); } - onError(error3) { - this.handler.onError(error3); + onError(error2) { + this.handler.onError(error2); } onHeaders(statusCode, headers, resume, statusText) { this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body) ? null : parseLocation(statusCode, headers); @@ -8457,7 +8176,7 @@ var require_pool = __commonJS({ this[kOptions] = { ...util.deepClone(options), connect, allowH2 }; this[kOptions].interceptors = options.interceptors ? { ...options.interceptors } : void 0; this[kFactory] = factory; - this.on("connectionError", (origin2, targets, error3) => { + this.on("connectionError", (origin2, targets, error2) => { for (const target of targets) { const idx = this[kClients].indexOf(target); if (idx !== -1) { @@ -8802,7 +8521,7 @@ var require_proxy_agent = __commonJS({ return this.#client.destroy(err); } }; - var ProxyAgent = class extends DispatcherBase { + var ProxyAgent2 = class extends DispatcherBase { constructor(opts) { super(); if (!opts || typeof opts === "object" && !(opts instanceof URL2) && !opts.uri) { @@ -8943,7 +8662,7 @@ var require_proxy_agent = __commonJS({ throw new InvalidArgumentError("Proxy-Authorization should be sent in ProxyAgent constructor"); } } - module.exports = ProxyAgent; + module.exports = ProxyAgent2; } }); @@ -8953,7 +8672,7 @@ var require_env_http_proxy_agent = __commonJS({ "use strict"; var DispatcherBase = require_dispatcher_base(); var { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = require_symbols(); - var ProxyAgent = require_proxy_agent(); + var ProxyAgent2 = require_proxy_agent(); var Agent = require_agent(); var DEFAULT_PORTS = { "http:": 80, @@ -8977,13 +8696,13 @@ var require_env_http_proxy_agent = __commonJS({ this[kNoProxyAgent] = new Agent(agentOpts); const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY; if (HTTP_PROXY) { - this[kHttpProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTP_PROXY }); + this[kHttpProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTP_PROXY }); } else { this[kHttpProxyAgent] = this[kNoProxyAgent]; } const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY; if (HTTPS_PROXY) { - this[kHttpsProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTPS_PROXY }); + this[kHttpsProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTPS_PROXY }); } else { this[kHttpsProxyAgent] = this[kHttpProxyAgent]; } @@ -10824,13 +10543,13 @@ var require_mock_utils = __commonJS({ if (mockDispatch2.data.callback) { mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) }; } - const { data: { statusCode, data, headers, trailers, error: error3 }, delay, persist } = mockDispatch2; + const { data: { statusCode, data, headers, trailers, error: error2 }, delay, persist } = mockDispatch2; const { timesInvoked, times } = mockDispatch2; mockDispatch2.consumed = !persist && timesInvoked >= times; mockDispatch2.pending = timesInvoked < times; - if (error3 !== null) { + if (error2 !== null) { deleteMockDispatch(this[kDispatches], key); - handler2.onError(error3); + handler2.onError(error2); return true; } if (typeof delay === "number" && delay > 0) { @@ -10868,19 +10587,19 @@ var require_mock_utils = __commonJS({ if (agent.isMockActive) { try { mockDispatch.call(this, opts, handler2); - } catch (error3) { - if (error3 instanceof MockNotMatchedError) { + } catch (error2) { + if (error2 instanceof MockNotMatchedError) { const netConnect = agent[kGetNetConnect](); if (netConnect === false) { - throw new MockNotMatchedError(`${error3.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`); + throw new MockNotMatchedError(`${error2.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`); } if (checkNetConnect(netConnect, origin)) { originalDispatch.call(this, opts, handler2); } else { - throw new MockNotMatchedError(`${error3.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`); + throw new MockNotMatchedError(`${error2.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`); } } else { - throw error3; + throw error2; } } } else { @@ -11045,11 +10764,11 @@ var require_mock_interceptor = __commonJS({ /** * Mock an undici request with a defined error. */ - replyWithError(error3) { - if (typeof error3 === "undefined") { + replyWithError(error2) { + if (typeof error2 === "undefined") { throw new InvalidArgumentError("error must be defined"); } - const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error: error3 }); + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error: error2 }); return new MockScope(newMockDispatch); } /** @@ -12010,12 +11729,12 @@ var require_headers = __commonJS({ append(name, value, isLowerCase) { this[kHeadersSortedMap] = null; const lowercaseName = isLowerCase ? name : name.toLowerCase(); - const exists = this[kHeadersMap].get(lowercaseName); - if (exists) { + const exists2 = this[kHeadersMap].get(lowercaseName); + if (exists2) { const delimiter = lowercaseName === "cookie" ? "; " : ", "; this[kHeadersMap].set(lowercaseName, { - name: exists.name, - value: `${exists.value}${delimiter}${value}` + name: exists2.name, + value: `${exists2.value}${delimiter}${value}` }); } else { this[kHeadersMap].set(lowercaseName, { name, value }); @@ -12140,7 +11859,7 @@ var require_headers = __commonJS({ } } }; - var Headers = class _Headers { + var Headers2 = class _Headers { #guard; #headersList; constructor(init = void 0) { @@ -12290,13 +12009,13 @@ var require_headers = __commonJS({ o.#headersList = list; } }; - var { getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList } = Headers; - Reflect.deleteProperty(Headers, "getHeadersGuard"); - Reflect.deleteProperty(Headers, "setHeadersGuard"); - Reflect.deleteProperty(Headers, "getHeadersList"); - Reflect.deleteProperty(Headers, "setHeadersList"); - iteratorMixin("Headers", Headers, kHeadersSortedMap, 0, 1); - Object.defineProperties(Headers.prototype, { + var { getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList } = Headers2; + Reflect.deleteProperty(Headers2, "getHeadersGuard"); + Reflect.deleteProperty(Headers2, "setHeadersGuard"); + Reflect.deleteProperty(Headers2, "getHeadersList"); + Reflect.deleteProperty(Headers2, "setHeadersList"); + iteratorMixin("Headers", Headers2, kHeadersSortedMap, 0, 1); + Object.defineProperties(Headers2.prototype, { append: kEnumerableProperty, delete: kEnumerableProperty, get: kEnumerableProperty, @@ -12314,7 +12033,7 @@ var require_headers = __commonJS({ webidl.converters.HeadersInit = function(V, prefix, argument) { if (webidl.util.Type(V) === "Object") { const iterator2 = Reflect.get(V, Symbol.iterator); - if (!util.types.isProxy(V) && iterator2 === Headers.prototype.entries) { + if (!util.types.isProxy(V) && iterator2 === Headers2.prototype.entries) { try { return getHeadersList(V).entriesList; } catch { @@ -12335,7 +12054,7 @@ var require_headers = __commonJS({ fill, // for test. compareHeaderName, - Headers, + Headers: Headers2, HeadersList, getHeadersGuard, setHeadersGuard, @@ -12349,7 +12068,7 @@ var require_headers = __commonJS({ var require_response = __commonJS({ "node_modules/undici/lib/web/fetch/response.js"(exports, module) { "use strict"; - var { Headers, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers(); + var { Headers: Headers2, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = require_headers(); var { extractBody, cloneBody, mixinBody, hasFinalizationRegistry, streamRegistry, bodyUnusable } = require_body(); var util = require_util(); var nodeUtil = __require("node:util"); @@ -12427,7 +12146,7 @@ var require_response = __commonJS({ } init = webidl.converters.ResponseInit(init); this[kState] = makeResponse({}); - this[kHeaders] = new Headers(kConstruct); + this[kHeaders] = new Headers2(kConstruct); setHeadersGuard(this[kHeaders], "response"); setHeadersList(this[kHeaders], this[kState].headersList); let bodyWithType = null; @@ -12671,7 +12390,7 @@ var require_response = __commonJS({ function fromInnerResponse(innerResponse, guard) { const response = new Response(kConstruct); response[kState] = innerResponse; - response[kHeaders] = new Headers(kConstruct); + response[kHeaders] = new Headers2(kConstruct); setHeadersList(response[kHeaders], innerResponse.headersList); setHeadersGuard(response[kHeaders], guard); if (hasFinalizationRegistry && innerResponse.body?.stream) { @@ -12791,7 +12510,7 @@ var require_request2 = __commonJS({ "node_modules/undici/lib/web/fetch/request.js"(exports, module) { "use strict"; var { extractBody, mixinBody, cloneBody, bodyUnusable } = require_body(); - var { Headers, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers(); + var { Headers: Headers2, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = require_headers(); var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref()(); var util = require_util(); var nodeUtil = __require("node:util"); @@ -13059,7 +12778,7 @@ var require_request2 = __commonJS({ requestFinalizer.register(ac, { signal, abort }, abort); } } - this[kHeaders] = new Headers(kConstruct); + this[kHeaders] = new Headers2(kConstruct); setHeadersList(this[kHeaders], request2.headersList); setHeadersGuard(this[kHeaders], "request"); if (mode === "no-cors") { @@ -13348,7 +13067,7 @@ var require_request2 = __commonJS({ const request2 = new Request(kConstruct); request2[kState] = innerRequest; request2[kSignal] = signal; - request2[kHeaders] = new Headers(kConstruct); + request2[kHeaders] = new Headers2(kConstruct); setHeadersList(request2[kHeaders], innerRequest.headersList); setHeadersGuard(request2[kHeaders], guard); return request2; @@ -13567,17 +13286,17 @@ var require_fetch = __commonJS({ this.emit("terminated", reason); } // https://fetch.spec.whatwg.org/#fetch-controller-abort - abort(error3) { + abort(error2) { if (this.state !== "ongoing") { return; } this.state = "aborted"; - if (!error3) { - error3 = new DOMException("The operation was aborted.", "AbortError"); + if (!error2) { + error2 = new DOMException("The operation was aborted.", "AbortError"); } - this.serializedAbortReason = error3; - this.connection?.destroy(error3); - this.emit("terminated", error3); + this.serializedAbortReason = error2; + this.connection?.destroy(error2); + this.emit("terminated", error2); } }; function handleFetchDone(response) { @@ -13673,12 +13392,12 @@ var require_fetch = __commonJS({ ); } var markResourceTiming = performance.markResourceTiming; - function abortFetch(p, request2, responseObject, error3) { + function abortFetch(p, request2, responseObject, error2) { if (p) { - p.reject(error3); + p.reject(error2); } if (request2.body != null && isReadable(request2.body?.stream)) { - request2.body.stream.cancel(error3).catch((err) => { + request2.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13690,7 +13409,7 @@ var require_fetch = __commonJS({ } const response = responseObject[kState]; if (response.body != null && isReadable(response.body?.stream)) { - response.body.stream.cancel(error3).catch((err) => { + response.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -14511,13 +14230,13 @@ var require_fetch = __commonJS({ fetchParams.controller.ended = true; this.body.push(null); }, - onError(error3) { + onError(error2) { if (this.abort) { fetchParams.controller.off("terminated", this.abort); } - this.body?.destroy(error3); - fetchParams.controller.terminate(error3); - reject(error3); + this.body?.destroy(error2); + fetchParams.controller.terminate(error2); + reject(error2); }, onUpgrade(status, rawHeaders, socket) { if (status !== 101) { @@ -14980,8 +14699,8 @@ var require_util4 = __commonJS({ } fr[kResult] = result; fireAProgressEvent("load", fr); - } catch (error3) { - fr[kError] = error3; + } catch (error2) { + fr[kError] = error2; fireAProgressEvent("error", fr); } if (fr[kState] !== "loading") { @@ -14990,13 +14709,13 @@ var require_util4 = __commonJS({ }); break; } - } catch (error3) { + } catch (error2) { if (fr[kAborted]) { return; } queueMicrotask(() => { fr[kState] = "done"; - fr[kError] = error3; + fr[kError] = error2; fireAProgressEvent("error", fr); if (fr[kState] !== "loading") { fireAProgressEvent("loadend", fr); @@ -16386,10 +16105,10 @@ var require_cookies = __commonJS({ var { parseSetCookie } = require_parse(); var { stringify } = require_util6(); var { webidl } = require_webidl(); - var { Headers } = require_headers(); + var { Headers: Headers2 } = require_headers(); function getCookies(headers) { webidl.argumentLengthCheck(arguments, 1, "getCookies"); - webidl.brandCheck(headers, Headers, { strict: false }); + webidl.brandCheck(headers, Headers2, { strict: false }); const cookie = headers.get("cookie"); const out = {}; if (!cookie) { @@ -16402,7 +16121,7 @@ var require_cookies = __commonJS({ return out; } function deleteCookie(headers, name, attributes) { - webidl.brandCheck(headers, Headers, { strict: false }); + webidl.brandCheck(headers, Headers2, { strict: false }); const prefix = "deleteCookie"; webidl.argumentLengthCheck(arguments, 2, prefix); name = webidl.converters.DOMString(name, prefix, "name"); @@ -16416,7 +16135,7 @@ var require_cookies = __commonJS({ } function getSetCookies(headers) { webidl.argumentLengthCheck(arguments, 1, "getSetCookies"); - webidl.brandCheck(headers, Headers, { strict: false }); + webidl.brandCheck(headers, Headers2, { strict: false }); const cookies = headers.getSetCookie(); if (!cookies) { return []; @@ -16425,7 +16144,7 @@ var require_cookies = __commonJS({ } function setCookie(headers, cookie) { webidl.argumentLengthCheck(arguments, 2, "setCookie"); - webidl.brandCheck(headers, Headers, { strict: false }); + webidl.brandCheck(headers, Headers2, { strict: false }); cookie = webidl.converters.Cookie(cookie); const str = stringify(cookie); if (str) { @@ -17023,13 +16742,13 @@ var require_frame = __commonJS({ "use strict"; var { maxUnsigned16Bit } = require_constants5(); var BUFFER_SIZE = 16386; - var crypto; + var crypto2; var buffer = null; var bufIdx = BUFFER_SIZE; try { - crypto = __require("node:crypto"); + crypto2 = __require("node:crypto"); } catch { - crypto = { + crypto2 = { // not full compatibility, but minimum. randomFillSync: function randomFillSync(buffer2, _offset, _size) { for (let i = 0; i < buffer2.length; ++i) { @@ -17042,7 +16761,7 @@ var require_frame = __commonJS({ function generateMask() { if (bufIdx === BUFFER_SIZE) { bufIdx = 0; - crypto.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); + crypto2.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE); } return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]]; } @@ -17111,12 +16830,12 @@ var require_connection = __commonJS({ var { CloseEvent } = require_events(); var { makeRequest } = require_request2(); var { fetching } = require_fetch(); - var { Headers, getHeadersList } = require_headers(); + var { Headers: Headers2, getHeadersList } = require_headers(); var { getDecodeSplit } = require_util2(); var { WebsocketFrameSend } = require_frame(); - var crypto; + var crypto2; try { - crypto = __require("node:crypto"); + crypto2 = __require("node:crypto"); } catch { } function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) { @@ -17133,10 +16852,10 @@ var require_connection = __commonJS({ redirect: "error" }); if (options.headers) { - const headersList = getHeadersList(new Headers(options.headers)); + const headersList = getHeadersList(new Headers2(options.headers)); request2.headersList = headersList; } - const keyValue = crypto.randomBytes(16).toString("base64"); + const keyValue = crypto2.randomBytes(16).toString("base64"); request2.headersList.append("sec-websocket-key", keyValue); request2.headersList.append("sec-websocket-version", "13"); for (const protocol of protocols) { @@ -17166,7 +16885,7 @@ var require_connection = __commonJS({ return; } const secWSAccept = response.headersList.get("Sec-WebSocket-Accept"); - const digest = crypto.createHash("sha1").update(keyValue + uid).digest("base64"); + const digest = crypto2.createHash("sha1").update(keyValue + uid).digest("base64"); if (secWSAccept !== digest) { failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header."); return; @@ -17264,11 +16983,11 @@ var require_connection = __commonJS({ }); } } - function onSocketError(error3) { + function onSocketError(error2) { const { ws } = this; ws[kReadyState] = states.CLOSING; if (channels.socketError.hasSubscribers) { - channels.socketError.publish(error3); + channels.socketError.publish(error2); } this.destroy(); } @@ -17493,9 +17212,9 @@ var require_receiver = __commonJS({ } this.#state = parserStates.INFO; } else { - this.#extensions.get("permessage-deflate").decompress(body, this.#info.fin, (error3, data) => { - if (error3) { - closeWebSocketConnection(this.ws, 1007, error3.message, error3.message.length); + this.#extensions.get("permessage-deflate").decompress(body, this.#info.fin, (error2, data) => { + if (error2) { + closeWebSocketConnection(this.ws, 1007, error2.message, error2.message.length); return; } this.#fragments.push(data); @@ -18527,8 +18246,8 @@ var require_eventsource = __commonJS({ pipeline2( response.body.stream, eventSourceStream, - (error3) => { - if (error3?.aborted === false) { + (error2) => { + if (error2?.aborted === false) { this.close(); this.dispatchEvent(new Event("error")); } @@ -18668,7 +18387,7 @@ var require_undici = __commonJS({ var Pool = require_pool(); var BalancedPool = require_balanced_pool(); var Agent = require_agent(); - var ProxyAgent = require_proxy_agent(); + var ProxyAgent2 = require_proxy_agent(); var EnvHttpProxyAgent = require_env_http_proxy_agent(); var RetryAgent = require_retry_agent(); var errors = require_errors(); @@ -18691,7 +18410,7 @@ var require_undici = __commonJS({ module.exports.Pool = Pool; module.exports.BalancedPool = BalancedPool; module.exports.Agent = Agent; - module.exports.ProxyAgent = ProxyAgent; + module.exports.ProxyAgent = ProxyAgent2; module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent; module.exports.RetryAgent = RetryAgent; module.exports.RetryHandler = RetryHandler; @@ -18801,48 +18520,129 @@ var require_undici = __commonJS({ } }); -// node_modules/@actions/http-client/lib/index.js -var require_lib = __commonJS({ - "node_modules/@actions/http-client/lib/index.js"(exports) { +// node_modules/@actions/http-client/lib/proxy.js +var require_proxy = __commonJS({ + "node_modules/@actions/http-client/lib/proxy.js"(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getProxyUrl = getProxyUrl2; + exports.checkBypass = checkBypass; + function getProxyUrl2(reqUrl) { + const usingSsl = reqUrl.protocol === "https:"; + if (checkBypass(reqUrl)) { + return void 0; } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + const proxyVar = (() => { + if (usingSsl) { + return process.env["https_proxy"] || process.env["HTTPS_PROXY"]; + } else { + return process.env["http_proxy"] || process.env["HTTP_PROXY"]; } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + })(); + if (proxyVar) { + try { + return new DecodedURL(proxyVar); + } catch (_a) { + if (!proxyVar.startsWith("http://") && !proxyVar.startsWith("https://")) + return new DecodedURL(`http://${proxyVar}`); + } + } else { + return void 0; + } + } + function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + const reqHost = reqUrl.hostname; + if (isLoopbackAddress(reqHost)) { + return true; + } + const noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || ""; + if (!noProxy) { + return false; + } + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } else if (reqUrl.protocol === "http:") { + reqPort = 80; + } else if (reqUrl.protocol === "https:") { + reqPort = 443; + } + const upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === "number") { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + for (const upperNoProxyItem of noProxy.split(",").map((x) => x.trim().toUpperCase()).filter((x) => x)) { + if (upperNoProxyItem === "*" || upperReqHosts.some((x) => x === upperNoProxyItem || x.endsWith(`.${upperNoProxyItem}`) || upperNoProxyItem.startsWith(".") && x.endsWith(`${upperNoProxyItem}`))) { + return true; + } + } + return false; + } + function isLoopbackAddress(host) { + const hostLower = host.toLowerCase(); + return hostLower === "localhost" || hostLower.startsWith("127.") || hostLower.startsWith("[::1]") || hostLower.startsWith("[0:0:0:0:0:0:0:1]"); + } + var DecodedURL = class extends URL { + constructor(url, base) { + super(url, base); + this._decodedUsername = decodeURIComponent(super.username); + this._decodedPassword = decodeURIComponent(super.password); + } + get username() { + return this._decodedUsername; + } + get password() { + return this._decodedPassword; + } + }; + } +}); + +// node_modules/@actions/http-client/lib/index.js +var require_lib = __commonJS({ + "node_modules/@actions/http-client/lib/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + } + __setModuleDefault(result, mod); + return result; + }; + })(); + var __awaiter3 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); @@ -18871,67 +18671,67 @@ var require_lib = __commonJS({ }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HttpClient = exports.HttpClientResponse = exports.HttpClientError = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; - exports.getProxyUrl = getProxyUrl; + exports.getProxyUrl = getProxyUrl2; exports.isHttps = isHttps; var http = __importStar(__require("http")); var https = __importStar(__require("https")); var pm = __importStar(require_proxy()); - var tunnel = __importStar(require_tunnel2()); + var tunnel2 = __importStar(require_tunnel2()); var undici_1 = require_undici(); - var HttpCodes; - (function(HttpCodes2) { - HttpCodes2[HttpCodes2["OK"] = 200] = "OK"; - HttpCodes2[HttpCodes2["MultipleChoices"] = 300] = "MultipleChoices"; - HttpCodes2[HttpCodes2["MovedPermanently"] = 301] = "MovedPermanently"; - HttpCodes2[HttpCodes2["ResourceMoved"] = 302] = "ResourceMoved"; - HttpCodes2[HttpCodes2["SeeOther"] = 303] = "SeeOther"; - HttpCodes2[HttpCodes2["NotModified"] = 304] = "NotModified"; - HttpCodes2[HttpCodes2["UseProxy"] = 305] = "UseProxy"; - HttpCodes2[HttpCodes2["SwitchProxy"] = 306] = "SwitchProxy"; - HttpCodes2[HttpCodes2["TemporaryRedirect"] = 307] = "TemporaryRedirect"; - HttpCodes2[HttpCodes2["PermanentRedirect"] = 308] = "PermanentRedirect"; - HttpCodes2[HttpCodes2["BadRequest"] = 400] = "BadRequest"; - HttpCodes2[HttpCodes2["Unauthorized"] = 401] = "Unauthorized"; - HttpCodes2[HttpCodes2["PaymentRequired"] = 402] = "PaymentRequired"; - HttpCodes2[HttpCodes2["Forbidden"] = 403] = "Forbidden"; - HttpCodes2[HttpCodes2["NotFound"] = 404] = "NotFound"; - HttpCodes2[HttpCodes2["MethodNotAllowed"] = 405] = "MethodNotAllowed"; - HttpCodes2[HttpCodes2["NotAcceptable"] = 406] = "NotAcceptable"; - HttpCodes2[HttpCodes2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; - HttpCodes2[HttpCodes2["RequestTimeout"] = 408] = "RequestTimeout"; - HttpCodes2[HttpCodes2["Conflict"] = 409] = "Conflict"; - HttpCodes2[HttpCodes2["Gone"] = 410] = "Gone"; - HttpCodes2[HttpCodes2["TooManyRequests"] = 429] = "TooManyRequests"; - HttpCodes2[HttpCodes2["InternalServerError"] = 500] = "InternalServerError"; - HttpCodes2[HttpCodes2["NotImplemented"] = 501] = "NotImplemented"; - HttpCodes2[HttpCodes2["BadGateway"] = 502] = "BadGateway"; - HttpCodes2[HttpCodes2["ServiceUnavailable"] = 503] = "ServiceUnavailable"; - HttpCodes2[HttpCodes2["GatewayTimeout"] = 504] = "GatewayTimeout"; - })(HttpCodes || (exports.HttpCodes = HttpCodes = {})); - var Headers; - (function(Headers2) { - Headers2["Accept"] = "accept"; - Headers2["ContentType"] = "content-type"; - })(Headers || (exports.Headers = Headers = {})); - var MediaTypes; - (function(MediaTypes2) { - MediaTypes2["ApplicationJson"] = "application/json"; - })(MediaTypes || (exports.MediaTypes = MediaTypes = {})); - function getProxyUrl(serverUrl) { + var HttpCodes2; + (function(HttpCodes3) { + HttpCodes3[HttpCodes3["OK"] = 200] = "OK"; + HttpCodes3[HttpCodes3["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes3[HttpCodes3["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes3[HttpCodes3["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes3[HttpCodes3["SeeOther"] = 303] = "SeeOther"; + HttpCodes3[HttpCodes3["NotModified"] = 304] = "NotModified"; + HttpCodes3[HttpCodes3["UseProxy"] = 305] = "UseProxy"; + HttpCodes3[HttpCodes3["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes3[HttpCodes3["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes3[HttpCodes3["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes3[HttpCodes3["BadRequest"] = 400] = "BadRequest"; + HttpCodes3[HttpCodes3["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes3[HttpCodes3["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes3[HttpCodes3["Forbidden"] = 403] = "Forbidden"; + HttpCodes3[HttpCodes3["NotFound"] = 404] = "NotFound"; + HttpCodes3[HttpCodes3["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes3[HttpCodes3["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes3[HttpCodes3["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes3[HttpCodes3["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes3[HttpCodes3["Conflict"] = 409] = "Conflict"; + HttpCodes3[HttpCodes3["Gone"] = 410] = "Gone"; + HttpCodes3[HttpCodes3["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes3[HttpCodes3["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes3[HttpCodes3["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes3[HttpCodes3["BadGateway"] = 502] = "BadGateway"; + HttpCodes3[HttpCodes3["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes3[HttpCodes3["GatewayTimeout"] = 504] = "GatewayTimeout"; + })(HttpCodes2 || (exports.HttpCodes = HttpCodes2 = {})); + var Headers2; + (function(Headers3) { + Headers3["Accept"] = "accept"; + Headers3["ContentType"] = "content-type"; + })(Headers2 || (exports.Headers = Headers2 = {})); + var MediaTypes2; + (function(MediaTypes3) { + MediaTypes3["ApplicationJson"] = "application/json"; + })(MediaTypes2 || (exports.MediaTypes = MediaTypes2 = {})); + function getProxyUrl2(serverUrl) { const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); return proxyUrl ? proxyUrl.href : ""; } - var HttpRedirectCodes = [ - HttpCodes.MovedPermanently, - HttpCodes.ResourceMoved, - HttpCodes.SeeOther, - HttpCodes.TemporaryRedirect, - HttpCodes.PermanentRedirect + var HttpRedirectCodes2 = [ + HttpCodes2.MovedPermanently, + HttpCodes2.ResourceMoved, + HttpCodes2.SeeOther, + HttpCodes2.TemporaryRedirect, + HttpCodes2.PermanentRedirect ]; - var HttpResponseRetryCodes = [ - HttpCodes.BadGateway, - HttpCodes.ServiceUnavailable, - HttpCodes.GatewayTimeout + var HttpResponseRetryCodes2 = [ + HttpCodes2.BadGateway, + HttpCodes2.ServiceUnavailable, + HttpCodes2.GatewayTimeout ]; var RetryableHttpVerbs = ["OPTIONS", "GET", "DELETE", "HEAD"]; var ExponentialBackoffCeiling = 10; @@ -18950,8 +18750,8 @@ var require_lib = __commonJS({ this.message = message; } readBody() { - return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve) => __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter3(this, void 0, void 0, function* () { let output = Buffer.alloc(0); this.message.on("data", (chunk) => { output = Buffer.concat([output, chunk]); @@ -18963,8 +18763,8 @@ var require_lib = __commonJS({ }); } readBodyBuffer() { - return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve) => __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter3(this, void 0, void 0, function* () { const chunks = []; this.message.on("data", (chunk) => { chunks.push(chunk); @@ -18981,7 +18781,7 @@ var require_lib = __commonJS({ const parsedUrl = new URL(requestUrl); return parsedUrl.protocol === "https:"; } - var HttpClient2 = class { + var HttpClient3 = class { constructor(userAgent2, handlers, requestOptions) { this._ignoreSslError = false; this._allowRedirects = true; @@ -19020,42 +18820,42 @@ var require_lib = __commonJS({ } } options(requestUrl, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("OPTIONS", requestUrl, null, additionalHeaders || {}); }); } get(requestUrl, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("GET", requestUrl, null, additionalHeaders || {}); }); } del(requestUrl, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("DELETE", requestUrl, null, additionalHeaders || {}); }); } post(requestUrl, data, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("POST", requestUrl, data, additionalHeaders || {}); }); } patch(requestUrl, data, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("PATCH", requestUrl, data, additionalHeaders || {}); }); } put(requestUrl, data, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("PUT", requestUrl, data, additionalHeaders || {}); }); } head(requestUrl, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request("HEAD", requestUrl, null, additionalHeaders || {}); }); } sendStream(verb, requestUrl, stream, additionalHeaders) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { return this.request(verb, requestUrl, stream, additionalHeaders); }); } @@ -19064,35 +18864,35 @@ var require_lib = __commonJS({ * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise */ getJson(requestUrl_1) { - return __awaiter2(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) { - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + return __awaiter3(this, arguments, void 0, function* (requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers2.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers2.Accept, MediaTypes2.ApplicationJson); const res = yield this.get(requestUrl, additionalHeaders); return this._processResponse(res, this.requestOptions); }); } postJson(requestUrl_1, obj_1) { - return __awaiter2(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { + return __awaiter3(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson); + additionalHeaders[Headers2.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers2.Accept, MediaTypes2.ApplicationJson); + additionalHeaders[Headers2.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes2.ApplicationJson); const res = yield this.post(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); } putJson(requestUrl_1, obj_1) { - return __awaiter2(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { + return __awaiter3(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson); + additionalHeaders[Headers2.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers2.Accept, MediaTypes2.ApplicationJson); + additionalHeaders[Headers2.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes2.ApplicationJson); const res = yield this.put(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); } patchJson(requestUrl_1, obj_1) { - return __awaiter2(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { + return __awaiter3(this, arguments, void 0, function* (requestUrl, obj, additionalHeaders = {}) { const data = JSON.stringify(obj, null, 2); - additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); - additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes.ApplicationJson); + additionalHeaders[Headers2.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers2.Accept, MediaTypes2.ApplicationJson); + additionalHeaders[Headers2.ContentType] = this._getExistingOrDefaultContentTypeHeader(additionalHeaders, MediaTypes2.ApplicationJson); const res = yield this.patch(requestUrl, data, additionalHeaders); return this._processResponse(res, this.requestOptions); }); @@ -19103,18 +18903,18 @@ var require_lib = __commonJS({ * Prefer get, del, post and patch */ request(verb, requestUrl, data, headers) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { if (this._disposed) { throw new Error("Client has already been disposed."); } const parsedUrl = new URL(requestUrl); - let info7 = this._prepareRequest(verb, parsedUrl, headers); + let info2 = this._prepareRequest(verb, parsedUrl, headers); const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1; let numTries = 0; let response; do { - response = yield this.requestRaw(info7, data); - if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { + response = yield this.requestRaw(info2, data); + if (response && response.message && response.message.statusCode === HttpCodes2.Unauthorized) { let authenticationHandler; for (const handler2 of this.handlers) { if (handler2.canHandleAuthentication(response)) { @@ -19123,13 +18923,13 @@ var require_lib = __commonJS({ } } if (authenticationHandler) { - return authenticationHandler.handleAuthentication(this, info7, data); + return authenticationHandler.handleAuthentication(this, info2, data); } else { return response; } } let redirectsRemaining = this._maxRedirects; - while (response.message.statusCode && HttpRedirectCodes.includes(response.message.statusCode) && this._allowRedirects && redirectsRemaining > 0) { + while (response.message.statusCode && HttpRedirectCodes2.includes(response.message.statusCode) && this._allowRedirects && redirectsRemaining > 0) { const redirectUrl = response.message.headers["location"]; if (!redirectUrl) { break; @@ -19146,11 +18946,11 @@ var require_lib = __commonJS({ } } } - info7 = this._prepareRequest(verb, parsedRedirectUrl, headers); - response = yield this.requestRaw(info7, data); + info2 = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info2, data); redirectsRemaining--; } - if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) { + if (!response.message.statusCode || !HttpResponseRetryCodes2.includes(response.message.statusCode)) { return response; } numTries += 1; @@ -19176,8 +18976,8 @@ var require_lib = __commonJS({ * @param info * @param data */ - requestRaw(info7, data) { - return __awaiter2(this, void 0, void 0, function* () { + requestRaw(info2, data) { + return __awaiter3(this, void 0, void 0, function* () { return new Promise((resolve, reject) => { function callbackForResult(err, res) { if (err) { @@ -19188,7 +18988,7 @@ var require_lib = __commonJS({ resolve(res); } } - this.requestRawWithCallback(info7, data, callbackForResult); + this.requestRawWithCallback(info2, data, callbackForResult); }); }); } @@ -19198,12 +18998,12 @@ var require_lib = __commonJS({ * @param data * @param onResult */ - requestRawWithCallback(info7, data, onResult) { + requestRawWithCallback(info2, data, onResult) { if (typeof data === "string") { - if (!info7.options.headers) { - info7.options.headers = {}; + if (!info2.options.headers) { + info2.options.headers = {}; } - info7.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); + info2.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); } let callbackCalled = false; function handleResult(err, res) { @@ -19212,7 +19012,7 @@ var require_lib = __commonJS({ onResult(err, res); } } - const req = info7.httpModule.request(info7.options, (msg) => { + const req = info2.httpModule.request(info2.options, (msg) => { const res = new HttpClientResponse(msg); handleResult(void 0, res); }); @@ -19224,7 +19024,7 @@ var require_lib = __commonJS({ if (socket) { socket.end(); } - handleResult(new Error(`Request timeout: ${info7.options.path}`)); + handleResult(new Error(`Request timeout: ${info2.options.path}`)); }); req.on("error", function(err) { handleResult(err); @@ -19260,27 +19060,27 @@ var require_lib = __commonJS({ return this._getProxyAgentDispatcher(parsedUrl, proxyUrl); } _prepareRequest(method, requestUrl, headers) { - const info7 = {}; - info7.parsedUrl = requestUrl; - const usingSsl = info7.parsedUrl.protocol === "https:"; - info7.httpModule = usingSsl ? https : http; + const info2 = {}; + info2.parsedUrl = requestUrl; + const usingSsl = info2.parsedUrl.protocol === "https:"; + info2.httpModule = usingSsl ? https : http; const defaultPort = usingSsl ? 443 : 80; - info7.options = {}; - info7.options.host = info7.parsedUrl.hostname; - info7.options.port = info7.parsedUrl.port ? parseInt(info7.parsedUrl.port) : defaultPort; - info7.options.path = (info7.parsedUrl.pathname || "") + (info7.parsedUrl.search || ""); - info7.options.method = method; - info7.options.headers = this._mergeHeaders(headers); + info2.options = {}; + info2.options.host = info2.parsedUrl.hostname; + info2.options.port = info2.parsedUrl.port ? parseInt(info2.parsedUrl.port) : defaultPort; + info2.options.path = (info2.parsedUrl.pathname || "") + (info2.parsedUrl.search || ""); + info2.options.method = method; + info2.options.headers = this._mergeHeaders(headers); if (this.userAgent != null) { - info7.options.headers["user-agent"] = this.userAgent; + info2.options.headers["user-agent"] = this.userAgent; } - info7.options.agent = this._getAgent(info7.parsedUrl); + info2.options.agent = this._getAgent(info2.parsedUrl); if (this.handlers) { for (const handler2 of this.handlers) { - handler2.prepareRequest(info7.options); + handler2.prepareRequest(info2.options); } } - return info7; + return info2; } _mergeHeaders(headers) { if (this.requestOptions && this.requestOptions.headers) { @@ -19322,7 +19122,7 @@ var require_lib = __commonJS({ _getExistingOrDefaultContentTypeHeader(additionalHeaders, _default) { let clientHeader; if (this.requestOptions && this.requestOptions.headers) { - const headerValue = lowercaseKeys2(this.requestOptions.headers)[Headers.ContentType]; + const headerValue = lowercaseKeys2(this.requestOptions.headers)[Headers2.ContentType]; if (headerValue) { if (typeof headerValue === "number") { clientHeader = String(headerValue); @@ -19333,7 +19133,7 @@ var require_lib = __commonJS({ } } } - const additionalValue = additionalHeaders[Headers.ContentType]; + const additionalValue = additionalHeaders[Headers2.ContentType]; if (additionalValue !== void 0) { if (typeof additionalValue === "number") { return String(additionalValue); @@ -19377,9 +19177,9 @@ var require_lib = __commonJS({ let tunnelAgent; const overHttps = proxyUrl.protocol === "https:"; if (usingSsl) { - tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + tunnelAgent = overHttps ? tunnel2.httpsOverHttps : tunnel2.httpsOverHttp; } else { - tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + tunnelAgent = overHttps ? tunnel2.httpOverHttps : tunnel2.httpOverHttp; } agent = tunnelAgent(agentOptions); this._proxyAgent = agent; @@ -19426,22 +19226,22 @@ var require_lib = __commonJS({ return baseUserAgent; } _performExponentialBackoff(retryNumber) { - return __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); return new Promise((resolve) => setTimeout(() => resolve(), ms)); }); } _processResponse(res, options) { - return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { + return __awaiter3(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter3(this, void 0, void 0, function* () { const statusCode = res.message.statusCode || 0; const response = { statusCode, result: null, headers: {} }; - if (statusCode === HttpCodes.NotFound) { + if (statusCode === HttpCodes2.NotFound) { resolve(response); } function dateTimeDeserializer(key, value) { @@ -19487,2112 +19287,617 @@ var require_lib = __commonJS({ }); } }; - exports.HttpClient = HttpClient2; + exports.HttpClient = HttpClient3; var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); } }); -// node_modules/@actions/http-client/lib/auth.js -var require_auth = __commonJS({ - "node_modules/@actions/http-client/lib/auth.js"(exports) { +// node_modules/fast-content-type-parse/index.js +var require_fast_content_type_parse = __commonJS({ + "node_modules/fast-content-type-parse/index.js"(exports, module) { "use strict"; - var __awaiter2 = exports && exports.__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()); - }); + var NullObject = function NullObject2() { }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; - var BasicCredentialHandler = class { - constructor(username, password) { - this.username = username; - this.password = password; - } - prepareRequest(options) { - if (!options.headers) { - throw Error("The request has no headers"); - } - options.headers["Authorization"] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`; - } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; + NullObject.prototype = /* @__PURE__ */ Object.create(null); + var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu; + var quotedPairRE = /\\([\v\u0020-\u00ff])/gu; + var mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u; + var defaultContentType = { type: "", parameters: new NullObject() }; + Object.freeze(defaultContentType.parameters); + Object.freeze(defaultContentType); + function parse3(header) { + if (typeof header !== "string") { + throw new TypeError("argument header is required and must be a string"); } - handleAuthentication() { - return __awaiter2(this, void 0, void 0, function* () { - throw new Error("not implemented"); - }); + let index = header.indexOf(";"); + const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); + if (mediaTypeRE.test(type) === false) { + throw new TypeError("invalid media type"); } - }; - exports.BasicCredentialHandler = BasicCredentialHandler; - var BearerCredentialHandler = class { - constructor(token) { - this.token = token; + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + }; + if (index === -1) { + return result; } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - if (!options.headers) { - throw Error("The request has no headers"); + let key; + let match; + let value; + paramRE.lastIndex = index; + while (match = paramRE.exec(header)) { + if (match.index !== index) { + throw new TypeError("invalid parameter format"); + } + index += match[0].length; + key = match[1].toLowerCase(); + value = match[2]; + if (value[0] === '"') { + value = value.slice(1, value.length - 1); + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); } - options.headers["Authorization"] = `Bearer ${this.token}`; + result.parameters[key] = value; } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; + if (index !== header.length) { + throw new TypeError("invalid parameter format"); } - handleAuthentication() { - return __awaiter2(this, void 0, void 0, function* () { - throw new Error("not implemented"); - }); + return result; + } + function safeParse2(header) { + if (typeof header !== "string") { + return defaultContentType; } - }; - exports.BearerCredentialHandler = BearerCredentialHandler; - var PersonalAccessTokenCredentialHandler = class { - constructor(token) { - this.token = token; + let index = header.indexOf(";"); + const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); + if (mediaTypeRE.test(type) === false) { + return defaultContentType; } - // currently implements pre-authorization - // TODO: support preAuth = false where it hooks on 401 - prepareRequest(options) { - if (!options.headers) { - throw Error("The request has no headers"); - } - options.headers["Authorization"] = `Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`; + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + }; + if (index === -1) { + return result; } - // This handler cannot handle 401 - canHandleAuthentication() { - return false; + let key; + let match; + let value; + paramRE.lastIndex = index; + while (match = paramRE.exec(header)) { + if (match.index !== index) { + return defaultContentType; + } + index += match[0].length; + key = match[1].toLowerCase(); + value = match[2]; + if (value[0] === '"') { + value = value.slice(1, value.length - 1); + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); + } + result.parameters[key] = value; } - handleAuthentication() { - return __awaiter2(this, void 0, void 0, function* () { - throw new Error("not implemented"); - }); + if (index !== header.length) { + return defaultContentType; } - }; - exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + return result; + } + module.exports.default = { parse: parse3, safeParse: safeParse2 }; + module.exports.parse = parse3; + module.exports.safeParse = safeParse2; + module.exports.defaultContentType = defaultContentType; } }); -// node_modules/@actions/core/lib/oidc-utils.js -var require_oidc_utils = __commonJS({ - "node_modules/@actions/core/lib/oidc-utils.js"(exports) { - "use strict"; - var __awaiter2 = exports && exports.__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); +// src/main.ts +import * as process2 from "process"; +import * as fs4 from "node:fs/promises"; + +// node_modules/@actions/core/lib/command.js +import * as os from "os"; + +// node_modules/@actions/core/lib/utils.js +function toCommandValue(input) { + if (input === null || input === void 0) { + return ""; + } else if (typeof input === "string" || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +function toCommandProperties(annotationProperties) { + if (!Object.keys(annotationProperties).length) { + return {}; + } + return { + title: annotationProperties.title, + file: annotationProperties.file, + line: annotationProperties.startLine, + endLine: annotationProperties.endLine, + col: annotationProperties.startColumn, + endColumn: annotationProperties.endColumn + }; +} + +// node_modules/@actions/core/lib/command.js +function issueCommand(command, properties, message) { + const cmd = new Command(command, properties, message); + process.stdout.write(cmd.toString() + os.EOL); +} +var CMD_STRING = "::"; +var Command = class { + constructor(command, properties, message) { + if (!command) { + command = "missing.command"; + } + this.command = command; + this.properties = properties; + this.message = message; + } + toString() { + let cmdStr = CMD_STRING + this.command; + if (this.properties && Object.keys(this.properties).length > 0) { + cmdStr += " "; + let first = true; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + if (first) { + first = false; + } else { + cmdStr += ","; + } + cmdStr += `${key}=${escapeProperty(val)}`; } } - 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.OidcClient = void 0; - var http_client_1 = require_lib(); - var auth_1 = require_auth(); - var core_1 = require_core(); - var OidcClient = class _OidcClient { - static createHttpClient(allowRetry = true, maxRetry = 10) { - const requestOptions = { - allowRetries: allowRetry, - maxRetries: maxRetry - }; - return new http_client_1.HttpClient("actions/oidc-client", [new auth_1.BearerCredentialHandler(_OidcClient.getRequestToken())], requestOptions); - } - static getRequestToken() { - const token = process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"]; - if (!token) { - throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable"); - } - return token; - } - static getIDTokenUrl() { - const runtimeUrl = process.env["ACTIONS_ID_TOKEN_REQUEST_URL"]; - if (!runtimeUrl) { - throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable"); - } - return runtimeUrl; - } - static getCall(id_token_url) { - return __awaiter2(this, void 0, void 0, function* () { - var _a; - const httpclient = _OidcClient.createHttpClient(); - const res = yield httpclient.getJson(id_token_url).catch((error3) => { - throw new Error(`Failed to get ID Token. - - Error Code : ${error3.statusCode} - - Error Message: ${error3.message}`); - }); - const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; - if (!id_token) { - throw new Error("Response json body do not have ID Token field"); - } - return id_token; - }); - } - static getIDToken(audience) { - return __awaiter2(this, void 0, void 0, function* () { - try { - let id_token_url = _OidcClient.getIDTokenUrl(); - if (audience) { - const encodedAudience = encodeURIComponent(audience); - id_token_url = `${id_token_url}&audience=${encodedAudience}`; - } - (0, core_1.debug)(`ID token url is ${id_token_url}`); - const id_token = yield _OidcClient.getCall(id_token_url); - (0, core_1.setSecret)(id_token); - return id_token; - } catch (error3) { - throw new Error(`Error message: ${error3.message}`); - } - }); - } - }; - exports.OidcClient = OidcClient; - } -}); - -// node_modules/@actions/core/lib/summary.js -var require_summary = __commonJS({ - "node_modules/@actions/core/lib/summary.js"(exports) { - "use strict"; - var __awaiter2 = exports && exports.__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.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; - var os_1 = __require("os"); - var fs_1 = __require("fs"); - var { 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"; - var Summary = class { - constructor() { - this._buffer = ""; - } - /** - * Finds the summary file path from the environment, rejects if env var is not found or file does not exist - * Also checks r/w permissions. - * - * @returns step summary file path - */ - filePath() { - return __awaiter2(this, void 0, void 0, function* () { - if (this._filePath) { - return this._filePath; - } - const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; - if (!pathFromEnv) { - throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); - } - try { - yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); - } catch (_a) { - throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); - } - this._filePath = pathFromEnv; - return this._filePath; - }); - } - /** - * Wraps content in an HTML tag, adding any HTML attributes - * - * @param {string} tag HTML tag to wrap - * @param {string | null} content content within the tag - * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add - * - * @returns {string} content wrapped in HTML element - */ - wrap(tag, content, attrs = {}) { - const htmlAttrs = Object.entries(attrs).map(([key, value]) => ` ${key}="${value}"`).join(""); - if (!content) { - return `<${tag}${htmlAttrs}>`; - } - return `<${tag}${htmlAttrs}>${content}`; - } - /** - * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. - * - * @param {SummaryWriteOptions} [options] (optional) options for write operation - * - * @returns {Promise} summary instance - */ - write(options) { - return __awaiter2(this, void 0, void 0, function* () { - const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); - const filePath = yield this.filePath(); - const writeFunc = overwrite ? writeFile : appendFile; - yield writeFunc(filePath, this._buffer, { encoding: "utf8" }); - return this.emptyBuffer(); - }); - } - /** - * Clears the summary buffer and wipes the summary file - * - * @returns {Summary} summary instance - */ - clear() { - return __awaiter2(this, void 0, void 0, function* () { - return this.emptyBuffer().write({ overwrite: true }); - }); - } - /** - * Returns the current summary buffer as a string - * - * @returns {string} string of summary buffer - */ - stringify() { - return this._buffer; - } - /** - * If the summary buffer is empty - * - * @returns {boolen} true if the buffer is empty - */ - isEmptyBuffer() { - return this._buffer.length === 0; - } - /** - * Resets the summary buffer without writing to summary file - * - * @returns {Summary} summary instance - */ - emptyBuffer() { - this._buffer = ""; - return this; - } - /** - * Adds raw text to the summary buffer - * - * @param {string} text content to add - * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) - * - * @returns {Summary} summary instance - */ - addRaw(text, addEOL = false) { - this._buffer += text; - return addEOL ? this.addEOL() : this; - } - /** - * Adds the operating system-specific end-of-line marker to the buffer - * - * @returns {Summary} summary instance - */ - addEOL() { - return this.addRaw(os_1.EOL); - } - /** - * Adds an HTML codeblock to the summary buffer - * - * @param {string} code content to render within fenced code block - * @param {string} lang (optional) language to syntax highlight code - * - * @returns {Summary} summary instance - */ - addCodeBlock(code, lang) { - const attrs = Object.assign({}, lang && { lang }); - const element = this.wrap("pre", this.wrap("code", code), attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML list to the summary buffer - * - * @param {string[]} items list of items to render - * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) - * - * @returns {Summary} summary instance - */ - addList(items, ordered = false) { - const tag = ordered ? "ol" : "ul"; - const listItems = items.map((item) => this.wrap("li", item)).join(""); - const element = this.wrap(tag, listItems); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML table to the summary buffer - * - * @param {SummaryTableCell[]} rows table rows - * - * @returns {Summary} summary instance - */ - addTable(rows) { - const tableBody = rows.map((row) => { - const cells = row.map((cell) => { - if (typeof cell === "string") { - return this.wrap("td", cell); - } - const { header, data, colspan, rowspan } = cell; - const tag = header ? "th" : "td"; - const attrs = Object.assign(Object.assign({}, colspan && { colspan }), rowspan && { rowspan }); - return this.wrap(tag, data, attrs); - }).join(""); - return this.wrap("tr", cells); - }).join(""); - const element = this.wrap("table", tableBody); - return this.addRaw(element).addEOL(); - } - /** - * Adds a collapsable HTML details element to the summary buffer - * - * @param {string} label text for the closed state - * @param {string} content collapsable content - * - * @returns {Summary} summary instance - */ - addDetails(label, content) { - const element = this.wrap("details", this.wrap("summary", label) + content); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML image tag to the summary buffer - * - * @param {string} src path to the image you to embed - * @param {string} alt text description of the image - * @param {SummaryImageOptions} options (optional) addition image attributes - * - * @returns {Summary} summary instance - */ - addImage(src, alt, options) { - const { width, height } = options || {}; - const attrs = Object.assign(Object.assign({}, width && { width }), height && { height }); - const element = this.wrap("img", null, Object.assign({ src, alt }, attrs)); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML section heading element - * - * @param {string} text heading text - * @param {number | string} [level=1] (optional) the heading level, default: 1 - * - * @returns {Summary} summary instance - */ - addHeading(text, level) { - const tag = `h${level}`; - const allowedTag = ["h1", "h2", "h3", "h4", "h5", "h6"].includes(tag) ? tag : "h1"; - const element = this.wrap(allowedTag, text); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML thematic break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addSeparator() { - const element = this.wrap("hr", null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML line break (
) to the summary buffer - * - * @returns {Summary} summary instance - */ - addBreak() { - const element = this.wrap("br", null); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML blockquote to the summary buffer - * - * @param {string} text quote text - * @param {string} cite (optional) citation url - * - * @returns {Summary} summary instance - */ - addQuote(text, cite) { - const attrs = Object.assign({}, cite && { cite }); - const element = this.wrap("blockquote", text, attrs); - return this.addRaw(element).addEOL(); - } - /** - * Adds an HTML anchor tag to the summary buffer - * - * @param {string} text link text/content - * @param {string} href hyperlink - * - * @returns {Summary} summary instance - */ - addLink(text, href) { - const element = this.wrap("a", text, { href }); - return this.addRaw(element).addEOL(); - } - }; - var _summary = new Summary(); - exports.markdownSummary = _summary; - exports.summary = _summary; - } -}); - -// node_modules/@actions/core/lib/path-utils.js -var require_path_utils = __commonJS({ - "node_modules/@actions/core/lib/path-utils.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.toPosixPath = toPosixPath; - exports.toWin32Path = toWin32Path; - exports.toPlatformPath = toPlatformPath; - var path2 = __importStar(__require("path")); - function toPosixPath(pth) { - return pth.replace(/[\\]/g, "/"); - } - function toWin32Path(pth) { - return pth.replace(/[/]/g, "\\"); - } - function toPlatformPath(pth) { - return pth.replace(/[/\\]/g, path2.sep); - } - } -}); - -// node_modules/@actions/io/lib/io-util.js -var require_io_util = __commonJS({ - "node_modules/@actions/io/lib/io-util.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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()); - }); - }; - var _a; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; - exports.readlink = readlink; - exports.exists = exists; - exports.isDirectory = isDirectory; - exports.isRooted = isRooted; - exports.tryGetExecutablePath = tryGetExecutablePath; - exports.getCmdPath = getCmdPath; - var fs2 = __importStar(__require("fs")); - var path2 = __importStar(__require("path")); - _a = fs2.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; - exports.IS_WINDOWS = process.platform === "win32"; - function readlink(fsPath) { - return __awaiter2(this, void 0, void 0, function* () { - const result = yield fs2.promises.readlink(fsPath); - if (exports.IS_WINDOWS && !result.endsWith("\\")) { - return `${result}\\`; - } - return result; - }); - } - exports.UV_FS_O_EXLOCK = 268435456; - exports.READONLY = fs2.constants.O_RDONLY; - function exists(fsPath) { - return __awaiter2(this, void 0, void 0, function* () { - try { - yield (0, exports.stat)(fsPath); - } catch (err) { - if (err.code === "ENOENT") { - return false; - } - throw err; - } - return true; - }); - } - function isDirectory(fsPath_1) { - return __awaiter2(this, arguments, void 0, function* (fsPath, useStat = false) { - const stats = useStat ? yield (0, exports.stat)(fsPath) : yield (0, exports.lstat)(fsPath); - return stats.isDirectory(); - }); - } - function isRooted(p) { - p = normalizeSeparators(p); - if (!p) { - throw new Error('isRooted() parameter "p" cannot be empty'); - } - if (exports.IS_WINDOWS) { - return p.startsWith("\\") || /^[A-Z]:/i.test(p); - } - return p.startsWith("/"); - } - function tryGetExecutablePath(filePath, extensions) { - return __awaiter2(this, void 0, void 0, function* () { - let stats = void 0; - try { - stats = yield (0, exports.stat)(filePath); - } catch (err) { - if (err.code !== "ENOENT") { - console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); - } - } - if (stats && stats.isFile()) { - if (exports.IS_WINDOWS) { - const upperExt = path2.extname(filePath).toUpperCase(); - if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) { - return filePath; - } - } else { - if (isUnixExecutable(stats)) { - return filePath; - } - } - } - const originalFilePath = filePath; - for (const extension of extensions) { - filePath = originalFilePath + extension; - stats = void 0; - try { - stats = yield (0, exports.stat)(filePath); - } catch (err) { - if (err.code !== "ENOENT") { - console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); - } - } - if (stats && stats.isFile()) { - if (exports.IS_WINDOWS) { - try { - const directory = path2.dirname(filePath); - const upperName = path2.basename(filePath).toUpperCase(); - for (const actualName of yield (0, exports.readdir)(directory)) { - if (upperName === actualName.toUpperCase()) { - filePath = path2.join(directory, actualName); - break; - } - } - } catch (err) { - console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); - } - return filePath; - } else { - if (isUnixExecutable(stats)) { - return filePath; - } - } - } - } - return ""; - }); - } - function normalizeSeparators(p) { - p = p || ""; - if (exports.IS_WINDOWS) { - p = p.replace(/\//g, "\\"); - return p.replace(/\\\\+/g, "\\"); - } - return p.replace(/\/\/+/g, "/"); - } - function isUnixExecutable(stats) { - return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && process.getgid !== void 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && process.getuid !== void 0 && stats.uid === process.getuid(); - } - function getCmdPath() { - var _a2; - return (_a2 = process.env["COMSPEC"]) !== null && _a2 !== void 0 ? _a2 : `cmd.exe`; - } - } -}); - -// node_modules/@actions/io/lib/io.js -var require_io = __commonJS({ - "node_modules/@actions/io/lib/io.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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.cp = cp; - exports.mv = mv; - exports.rmRF = rmRF; - exports.mkdirP = mkdirP; - exports.which = which; - exports.findInPath = findInPath; - var assert_1 = __require("assert"); - var path2 = __importStar(__require("path")); - var ioUtil = __importStar(require_io_util()); - function cp(source_1, dest_1) { - return __awaiter2(this, arguments, void 0, function* (source, dest, options = {}) { - const { force, recursive, copySourceDirectory } = readCopyOptions(options); - const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; - if (destStat && destStat.isFile() && !force) { - return; - } - const newDest = destStat && destStat.isDirectory() && copySourceDirectory ? path2.join(dest, path2.basename(source)) : dest; - if (!(yield ioUtil.exists(source))) { - throw new Error(`no such file or directory: ${source}`); - } - const sourceStat = yield ioUtil.stat(source); - if (sourceStat.isDirectory()) { - if (!recursive) { - throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`); - } else { - yield cpDirRecursive(source, newDest, 0, force); - } - } else { - if (path2.relative(source, newDest) === "") { - throw new Error(`'${newDest}' and '${source}' are the same file`); - } - yield copyFile(source, newDest, force); - } - }); - } - function mv(source_1, dest_1) { - return __awaiter2(this, arguments, void 0, function* (source, dest, options = {}) { - if (yield ioUtil.exists(dest)) { - let destExists = true; - if (yield ioUtil.isDirectory(dest)) { - dest = path2.join(dest, path2.basename(source)); - destExists = yield ioUtil.exists(dest); - } - if (destExists) { - if (options.force == null || options.force) { - yield rmRF(dest); - } else { - throw new Error("Destination already exists"); - } - } - } - yield mkdirP(path2.dirname(dest)); - yield ioUtil.rename(source, dest); - }); - } - function rmRF(inputPath) { - return __awaiter2(this, void 0, void 0, function* () { - if (ioUtil.IS_WINDOWS) { - if (/[*"<>|]/.test(inputPath)) { - throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); - } - } - try { - yield ioUtil.rm(inputPath, { - force: true, - maxRetries: 3, - recursive: true, - retryDelay: 300 - }); - } catch (err) { - throw new Error(`File was unable to be removed ${err}`); - } - }); - } - function mkdirP(fsPath) { - return __awaiter2(this, void 0, void 0, function* () { - (0, assert_1.ok)(fsPath, "a path argument must be provided"); - yield ioUtil.mkdir(fsPath, { recursive: true }); - }); - } - function which(tool, check) { - return __awaiter2(this, void 0, void 0, function* () { - if (!tool) { - throw new Error("parameter 'tool' is required"); - } - if (check) { - const result = yield which(tool, false); - if (!result) { - if (ioUtil.IS_WINDOWS) { - 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 verify the file has a valid extension for an executable file.`); - } else { - 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; - } - const matches = yield findInPath(tool); - if (matches && matches.length > 0) { - return matches[0]; - } - return ""; - }); - } - function findInPath(tool) { - return __awaiter2(this, void 0, void 0, function* () { - if (!tool) { - throw new Error("parameter 'tool' is required"); - } - const extensions = []; - if (ioUtil.IS_WINDOWS && process.env["PATHEXT"]) { - for (const extension of process.env["PATHEXT"].split(path2.delimiter)) { - if (extension) { - extensions.push(extension); - } - } - } - if (ioUtil.isRooted(tool)) { - const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); - if (filePath) { - return [filePath]; - } - return []; - } - if (tool.includes(path2.sep)) { - return []; - } - const directories = []; - if (process.env.PATH) { - for (const p of process.env.PATH.split(path2.delimiter)) { - if (p) { - directories.push(p); - } - } - } - const matches = []; - for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(path2.join(directory, tool), extensions); - if (filePath) { - matches.push(filePath); - } - } - return matches; - }); - } - function readCopyOptions(options) { - const force = options.force == null ? true : options.force; - const recursive = Boolean(options.recursive); - const copySourceDirectory = options.copySourceDirectory == null ? true : Boolean(options.copySourceDirectory); - return { force, recursive, copySourceDirectory }; - } - function cpDirRecursive(sourceDir, destDir, currentDepth, force) { - return __awaiter2(this, void 0, void 0, function* () { - if (currentDepth >= 255) - return; - currentDepth++; - yield mkdirP(destDir); - const files = yield ioUtil.readdir(sourceDir); - for (const fileName of files) { - const srcFile = `${sourceDir}/${fileName}`; - const destFile = `${destDir}/${fileName}`; - const srcFileStat = yield ioUtil.lstat(srcFile); - if (srcFileStat.isDirectory()) { - yield cpDirRecursive(srcFile, destFile, currentDepth, force); - } else { - yield copyFile(srcFile, destFile, force); - } - } - yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode); - }); - } - function copyFile(srcFile, destFile, force) { - return __awaiter2(this, void 0, void 0, function* () { - if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) { - try { - yield ioUtil.lstat(destFile); - yield ioUtil.unlink(destFile); - } catch (e) { - if (e.code === "EPERM") { - yield ioUtil.chmod(destFile, "0666"); - yield ioUtil.unlink(destFile); - } - } - const symlinkFull = yield ioUtil.readlink(srcFile); - yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? "junction" : null); - } else if (!(yield ioUtil.exists(destFile)) || force) { - yield ioUtil.copyFile(srcFile, destFile); - } - }); - } - } -}); - -// node_modules/@actions/exec/lib/toolrunner.js -var require_toolrunner = __commonJS({ - "node_modules/@actions/exec/lib/toolrunner.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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.ToolRunner = void 0; - exports.argStringToArray = argStringToArray; - var os = __importStar(__require("os")); - var events = __importStar(__require("events")); - var child = __importStar(__require("child_process")); - var path2 = __importStar(__require("path")); - var io = __importStar(require_io()); - var ioUtil = __importStar(require_io_util()); - var timers_1 = __require("timers"); - var IS_WINDOWS = process.platform === "win32"; - var ToolRunner = class extends events.EventEmitter { - constructor(toolPath, args, options) { - super(); - if (!toolPath) { - throw new Error("Parameter 'toolPath' cannot be null or empty."); - } - this.toolPath = toolPath; - this.args = args || []; - this.options = options || {}; - } - _debug(message) { - if (this.options.listeners && this.options.listeners.debug) { - this.options.listeners.debug(message); - } - } - _getCommandString(options, noPrefix) { - const toolPath = this._getSpawnFileName(); - const args = this._getSpawnArgs(options); - let cmd = noPrefix ? "" : "[command]"; - if (IS_WINDOWS) { - if (this._isCmdFile()) { - cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; - } - } else if (options.windowsVerbatimArguments) { - cmd += `"${toolPath}"`; - for (const a of args) { - cmd += ` ${a}`; - } - } else { - cmd += this._windowsQuoteCmdArg(toolPath); - for (const a of args) { - cmd += ` ${this._windowsQuoteCmdArg(a)}`; - } - } - } else { - cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; - } - } - return cmd; - } - _processLineBuffer(data, strBuffer, onLine) { - try { - let s = strBuffer + data.toString(); - let n = s.indexOf(os.EOL); - while (n > -1) { - const line = s.substring(0, n); - onLine(line); - s = s.substring(n + os.EOL.length); - n = s.indexOf(os.EOL); - } - return s; - } catch (err) { - this._debug(`error processing line. Failed with error ${err}`); - return ""; - } - } - _getSpawnFileName() { - if (IS_WINDOWS) { - if (this._isCmdFile()) { - return process.env["COMSPEC"] || "cmd.exe"; - } - } - return this.toolPath; - } - _getSpawnArgs(options) { - if (IS_WINDOWS) { - if (this._isCmdFile()) { - let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; - for (const a of this.args) { - argline += " "; - argline += options.windowsVerbatimArguments ? a : this._windowsQuoteCmdArg(a); - } - argline += '"'; - return [argline]; - } - } - return this.args; - } - _endsWith(str, end) { - return str.endsWith(end); - } - _isCmdFile() { - const upperToolPath = this.toolPath.toUpperCase(); - return this._endsWith(upperToolPath, ".CMD") || this._endsWith(upperToolPath, ".BAT"); - } - _windowsQuoteCmdArg(arg) { - if (!this._isCmdFile()) { - return this._uvQuoteCmdArg(arg); - } - if (!arg) { - return '""'; - } - const cmdSpecialChars = [ - " ", - " ", - "&", - "(", - ")", - "[", - "]", - "{", - "}", - "^", - "=", - ";", - "!", - "'", - "+", - ",", - "`", - "~", - "|", - "<", - ">", - '"' - ]; - let needsQuotes = false; - for (const char of arg) { - if (cmdSpecialChars.some((x) => x === char)) { - needsQuotes = true; - break; - } - } - if (!needsQuotes) { - return arg; - } - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === "\\") { - reverse += "\\"; - } else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += '"'; - } else { - quoteHit = false; - } - } - reverse += '"'; - return reverse.split("").reverse().join(""); - } - _uvQuoteCmdArg(arg) { - if (!arg) { - return '""'; - } - if (!arg.includes(" ") && !arg.includes(" ") && !arg.includes('"')) { - return arg; - } - if (!arg.includes('"') && !arg.includes("\\")) { - return `"${arg}"`; - } - let reverse = '"'; - let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === "\\") { - reverse += "\\"; - } else if (arg[i - 1] === '"') { - quoteHit = true; - reverse += "\\"; - } else { - quoteHit = false; - } - } - reverse += '"'; - return reverse.split("").reverse().join(""); - } - _cloneExecOptions(options) { - options = options || {}; - const result = { - cwd: options.cwd || process.cwd(), - env: options.env || process.env, - silent: options.silent || false, - windowsVerbatimArguments: options.windowsVerbatimArguments || false, - failOnStdErr: options.failOnStdErr || false, - ignoreReturnCode: options.ignoreReturnCode || false, - delay: options.delay || 1e4 - }; - result.outStream = options.outStream || process.stdout; - result.errStream = options.errStream || process.stderr; - return result; - } - _getSpawnOptions(options, toolPath) { - options = options || {}; - const result = {}; - result.cwd = options.cwd; - result.env = options.env; - result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile(); - if (options.windowsVerbatimArguments) { - result.argv0 = `"${toolPath}"`; - } - return result; - } - /** - * Exec a tool. - * Output will be streamed to the live console. - * Returns promise with return code - * - * @param tool path to tool to exec - * @param options optional exec options. See ExecOptions - * @returns number - */ - exec() { - return __awaiter2(this, void 0, void 0, function* () { - if (!ioUtil.isRooted(this.toolPath) && (this.toolPath.includes("/") || IS_WINDOWS && this.toolPath.includes("\\"))) { - this.toolPath = path2.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath); - } - this.toolPath = yield io.which(this.toolPath, true); - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { - this._debug(`exec tool: ${this.toolPath}`); - this._debug("arguments:"); - for (const arg of this.args) { - this._debug(` ${arg}`); - } - const optionsNonNull = this._cloneExecOptions(this.options); - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL); - } - const state = new ExecState(optionsNonNull, this.toolPath); - state.on("debug", (message) => { - this._debug(message); - }); - if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { - return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); - } - const fileName = this._getSpawnFileName(); - const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); - let stdbuffer = ""; - if (cp.stdout) { - cp.stdout.on("data", (data) => { - if (this.options.listeners && this.options.listeners.stdout) { - this.options.listeners.stdout(data); - } - if (!optionsNonNull.silent && optionsNonNull.outStream) { - optionsNonNull.outStream.write(data); - } - stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => { - if (this.options.listeners && this.options.listeners.stdline) { - this.options.listeners.stdline(line); - } - }); - }); - } - let errbuffer = ""; - if (cp.stderr) { - cp.stderr.on("data", (data) => { - state.processStderr = true; - if (this.options.listeners && this.options.listeners.stderr) { - this.options.listeners.stderr(data); - } - if (!optionsNonNull.silent && optionsNonNull.errStream && optionsNonNull.outStream) { - const s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; - s.write(data); - } - errbuffer = this._processLineBuffer(data, errbuffer, (line) => { - if (this.options.listeners && this.options.listeners.errline) { - this.options.listeners.errline(line); - } - }); - }); - } - cp.on("error", (err) => { - state.processError = err.message; - state.processExited = true; - state.processClosed = true; - state.CheckComplete(); - }); - cp.on("exit", (code) => { - state.processExitCode = code; - state.processExited = true; - this._debug(`Exit code ${code} received from tool '${this.toolPath}'`); - state.CheckComplete(); - }); - cp.on("close", (code) => { - state.processExitCode = code; - state.processExited = true; - state.processClosed = true; - this._debug(`STDIO streams have closed for tool '${this.toolPath}'`); - state.CheckComplete(); - }); - state.on("done", (error3, exitCode) => { - if (stdbuffer.length > 0) { - this.emit("stdline", stdbuffer); - } - if (errbuffer.length > 0) { - this.emit("errline", errbuffer); - } - cp.removeAllListeners(); - if (error3) { - reject(error3); - } else { - resolve(exitCode); - } - }); - if (this.options.input) { - if (!cp.stdin) { - throw new Error("child process missing stdin"); - } - cp.stdin.end(this.options.input); - } - })); - }); - } - }; - exports.ToolRunner = ToolRunner; - function argStringToArray(argString) { - const args = []; - let inQuotes = false; - let escaped = false; - let arg = ""; - function append(c) { - if (escaped && c !== '"') { - arg += "\\"; - } - arg += c; - escaped = false; - } - for (let i = 0; i < argString.length; i++) { - const c = argString.charAt(i); - if (c === '"') { - if (!escaped) { - inQuotes = !inQuotes; - } else { - append(c); - } - continue; - } - if (c === "\\" && escaped) { - append(c); - continue; - } - if (c === "\\" && inQuotes) { - escaped = true; - continue; - } - if (c === " " && !inQuotes) { - if (arg.length > 0) { - args.push(arg); - arg = ""; - } - continue; - } - append(c); - } - if (arg.length > 0) { - args.push(arg.trim()); - } - return args; - } - var ExecState = class _ExecState extends events.EventEmitter { - constructor(options, toolPath) { - super(); - this.processClosed = false; - this.processError = ""; - this.processExitCode = 0; - this.processExited = false; - this.processStderr = false; - this.delay = 1e4; - this.done = false; - this.timeout = null; - if (!toolPath) { - throw new Error("toolPath must not be empty"); - } - this.options = options; - this.toolPath = toolPath; - if (options.delay) { - this.delay = options.delay; - } - } - CheckComplete() { - if (this.done) { - return; - } - if (this.processClosed) { - this._setResult(); - } else if (this.processExited) { - this.timeout = (0, timers_1.setTimeout)(_ExecState.HandleTimeout, this.delay, this); - } - } - _debug(message) { - this.emit("debug", message); - } - _setResult() { - let error3; - if (this.processExited) { - if (this.processError) { - error3 = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`); - } else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) { - error3 = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`); - } else if (this.processStderr && this.options.failOnStdErr) { - error3 = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`); - } - } - if (this.timeout) { - clearTimeout(this.timeout); - this.timeout = null; - } - this.done = true; - this.emit("done", error3, this.processExitCode); - } - static HandleTimeout(state) { - if (state.done) { - return; - } - if (!state.processClosed && state.processExited) { - const message = `The STDIO streams did not close within ${state.delay / 1e3} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`; - state._debug(message); - } - state._setResult(); - } - }; - } -}); - -// node_modules/@actions/exec/lib/exec.js -var require_exec = __commonJS({ - "node_modules/@actions/exec/lib/exec.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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.exec = exec; - exports.getExecOutput = getExecOutput; - var string_decoder_1 = __require("string_decoder"); - var tr = __importStar(require_toolrunner()); - function exec(commandLine, args, options) { - return __awaiter2(this, void 0, void 0, function* () { - const commandArgs = tr.argStringToArray(commandLine); - if (commandArgs.length === 0) { - throw new Error(`Parameter 'commandLine' cannot be null or empty.`); - } - const toolPath = commandArgs[0]; - args = commandArgs.slice(1).concat(args || []); - const runner = new tr.ToolRunner(toolPath, args, options); - return runner.exec(); - }); - } - function getExecOutput(commandLine, args, options) { - return __awaiter2(this, void 0, void 0, function* () { - var _a, _b; - let stdout = ""; - let stderr = ""; - const stdoutDecoder = new string_decoder_1.StringDecoder("utf8"); - const stderrDecoder = new string_decoder_1.StringDecoder("utf8"); - const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout; - const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr; - const stdErrListener = (data) => { - stderr += stderrDecoder.write(data); - if (originalStdErrListener) { - originalStdErrListener(data); - } - }; - const stdOutListener = (data) => { - stdout += stdoutDecoder.write(data); - if (originalStdoutListener) { - originalStdoutListener(data); - } - }; - const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); - const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners })); - stdout += stdoutDecoder.end(); - stderr += stderrDecoder.end(); - return { - exitCode, - stdout, - stderr - }; - }); - } - } -}); - -// node_modules/@actions/core/lib/platform.js -var require_platform = __commonJS({ - "node_modules/@actions/core/lib/platform.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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()); - }); - }; - var __importDefault = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.isLinux = exports.isMacOS = exports.isWindows = exports.arch = exports.platform = void 0; - exports.getDetails = getDetails; - var os_1 = __importDefault(__require("os")); - var exec = __importStar(require_exec()); - var getWindowsInfo = () => __awaiter2(void 0, void 0, void 0, function* () { - const { stdout: version } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"', void 0, { - silent: true - }); - const { stdout: name } = yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"', void 0, { - silent: true - }); - return { - name: name.trim(), - version: version.trim() - }; - }); - var getMacOsInfo = () => __awaiter2(void 0, void 0, void 0, function* () { - var _a, _b, _c, _d; - const { stdout } = yield exec.getExecOutput("sw_vers", void 0, { - silent: true - }); - const version = (_b = (_a = stdout.match(/ProductVersion:\s*(.+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ""; - const name = (_d = (_c = stdout.match(/ProductName:\s*(.+)/)) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : ""; - return { - name, - version - }; - }); - var getLinuxInfo = () => __awaiter2(void 0, void 0, void 0, function* () { - const { stdout } = yield exec.getExecOutput("lsb_release", ["-i", "-r", "-s"], { - silent: true - }); - const [name, version] = stdout.trim().split("\n"); - return { - name, - version - }; - }); - exports.platform = os_1.default.platform(); - exports.arch = os_1.default.arch(); - exports.isWindows = exports.platform === "win32"; - exports.isMacOS = exports.platform === "darwin"; - exports.isLinux = exports.platform === "linux"; - function getDetails() { - return __awaiter2(this, void 0, void 0, function* () { - return Object.assign(Object.assign({}, yield exports.isWindows ? getWindowsInfo() : exports.isMacOS ? getMacOsInfo() : getLinuxInfo()), { - platform: exports.platform, - arch: exports.arch, - isWindows: exports.isWindows, - isMacOS: exports.isMacOS, - isLinux: exports.isLinux - }); - }); } + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; + return cmdStr; } -}); +}; +function escapeData(s) { + return toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); +} +function escapeProperty(s) { + return toCommandValue(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); +} + +// node_modules/@actions/core/lib/file-command.js +import * as crypto from "crypto"; +import * as fs from "fs"; +import * as os2 from "os"; +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, `${toCommandValue(message)}${os2.EOL}`, { + encoding: "utf8" + }); +} +function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${crypto.randomUUID()}`; + const convertedValue = 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}${os2.EOL}${convertedValue}${os2.EOL}${delimiter}`; +} // node_modules/@actions/core/lib/core.js -var require_core = __commonJS({ - "node_modules/@actions/core/lib/core.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; +import * as os4 from "os"; + +// node_modules/@actions/core/node_modules/@actions/http-client/lib/index.js +var tunnel = __toESM(require_tunnel2(), 1); +var import_undici = __toESM(require_undici(), 1); +var HttpCodes; +(function(HttpCodes2) { + HttpCodes2[HttpCodes2["OK"] = 200] = "OK"; + HttpCodes2[HttpCodes2["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes2[HttpCodes2["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes2[HttpCodes2["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes2[HttpCodes2["SeeOther"] = 303] = "SeeOther"; + HttpCodes2[HttpCodes2["NotModified"] = 304] = "NotModified"; + HttpCodes2[HttpCodes2["UseProxy"] = 305] = "UseProxy"; + HttpCodes2[HttpCodes2["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes2[HttpCodes2["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes2[HttpCodes2["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes2[HttpCodes2["BadRequest"] = 400] = "BadRequest"; + HttpCodes2[HttpCodes2["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes2[HttpCodes2["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes2[HttpCodes2["Forbidden"] = 403] = "Forbidden"; + HttpCodes2[HttpCodes2["NotFound"] = 404] = "NotFound"; + HttpCodes2[HttpCodes2["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes2[HttpCodes2["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes2[HttpCodes2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes2[HttpCodes2["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes2[HttpCodes2["Conflict"] = 409] = "Conflict"; + HttpCodes2[HttpCodes2["Gone"] = 410] = "Gone"; + HttpCodes2[HttpCodes2["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes2[HttpCodes2["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes2[HttpCodes2["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes2[HttpCodes2["BadGateway"] = 502] = "BadGateway"; + HttpCodes2[HttpCodes2["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes2[HttpCodes2["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes || (HttpCodes = {})); +var Headers; +(function(Headers2) { + Headers2["Accept"] = "accept"; + Headers2["ContentType"] = "content-type"; +})(Headers || (Headers = {})); +var MediaTypes; +(function(MediaTypes2) { + MediaTypes2["ApplicationJson"] = "application/json"; +})(MediaTypes || (MediaTypes = {})); +var HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +var HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; + +// node_modules/@actions/core/lib/summary.js +import { EOL as EOL3 } from "os"; +import { constants, promises } from "fs"; +var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); }); - var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - } - __setModuleDefault(result, mod); - return result; - }; - })(); - var __awaiter2 = exports && exports.__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.platform = exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = exports.markdownSummary = exports.summary = exports.ExitCode = void 0; - exports.exportVariable = exportVariable; - exports.setSecret = setSecret; - exports.addPath = addPath; - exports.getInput = getInput3; - exports.getMultilineInput = getMultilineInput; - exports.getBooleanInput = getBooleanInput2; - exports.setOutput = setOutput; - exports.setCommandEcho = setCommandEcho; - exports.setFailed = setFailed2; - exports.isDebug = isDebug; - exports.debug = debug; - exports.error = error3; - exports.warning = warning; - exports.notice = notice; - exports.info = info7; - exports.startGroup = startGroup; - exports.endGroup = endGroup; - exports.group = group; - exports.saveState = saveState; - exports.getState = getState; - exports.getIDToken = getIDToken; - var command_1 = require_command(); - var file_command_1 = require_file_command(); - var utils_1 = require_utils(); - var os = __importStar(__require("os")); - var path2 = __importStar(__require("path")); - var oidc_utils_1 = require_oidc_utils(); - var ExitCode; - (function(ExitCode2) { - ExitCode2[ExitCode2["Success"] = 0] = "Success"; - ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; - })(ExitCode || (exports.ExitCode = ExitCode = {})); - function exportVariable(name, val) { - const convertedVal = (0, utils_1.toCommandValue)(val); - process.env[name] = convertedVal; - const filePath = process.env["GITHUB_ENV"] || ""; - if (filePath) { - return (0, file_command_1.issueFileCommand)("ENV", (0, file_command_1.prepareKeyValueMessage)(name, val)); - } - (0, command_1.issueCommand)("set-env", { name }, convertedVal); - } - function setSecret(secret) { - (0, command_1.issueCommand)("add-mask", {}, secret); - } - function addPath(inputPath) { - const filePath = process.env["GITHUB_PATH"] || ""; - if (filePath) { - (0, file_command_1.issueFileCommand)("PATH", inputPath); - } else { - (0, command_1.issueCommand)("add-path", {}, inputPath); - } - process.env["PATH"] = `${inputPath}${path2.delimiter}${process.env["PATH"]}`; - } - function getInput3(name, options) { - const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || ""; - if (options && options.required && !val) { - throw new Error(`Input required and not supplied: ${name}`); - } - if (options && options.trimWhitespace === false) { - return val; - } - return val.trim(); - } - function getMultilineInput(name, options) { - const inputs = getInput3(name, options).split("\n").filter((x) => x !== ""); - if (options && options.trimWhitespace === false) { - return inputs; - } - return inputs.map((input) => input.trim()); - } - function getBooleanInput2(name, options) { - const trueValue = ["true", "True", "TRUE"]; - const falseValue = ["false", "False", "FALSE"]; - const val = getInput3(name, options); - if (trueValue.includes(val)) - return true; - if (falseValue.includes(val)) - return false; - throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} -Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); - } - function setOutput(name, value) { - const filePath = process.env["GITHUB_OUTPUT"] || ""; - if (filePath) { - return (0, file_command_1.issueFileCommand)("OUTPUT", (0, file_command_1.prepareKeyValueMessage)(name, value)); - } - process.stdout.write(os.EOL); - (0, command_1.issueCommand)("set-output", { name }, (0, utils_1.toCommandValue)(value)); - } - function setCommandEcho(enabled) { - (0, command_1.issue)("echo", enabled ? "on" : "off"); - } - function setFailed2(message) { - process.exitCode = ExitCode.Failure; - error3(message); - } - function isDebug() { - return process.env["RUNNER_DEBUG"] === "1"; - } - function debug(message) { - (0, command_1.issueCommand)("debug", {}, message); - } - function error3(message, properties = {}) { - (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); - } - function warning(message, properties = {}) { - (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); - } - function notice(message, properties = {}) { - (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); - } - function info7(message) { - process.stdout.write(message + os.EOL); - } - function startGroup(name) { - (0, command_1.issue)("group", name); - } - function endGroup() { - (0, command_1.issue)("endgroup"); - } - function group(name, fn) { - return __awaiter2(this, void 0, void 0, function* () { - startGroup(name); - let result; - try { - result = yield fn(); - } finally { - endGroup(); - } - return result; - }); - } - function saveState(name, value) { - const filePath = process.env["GITHUB_STATE"] || ""; - if (filePath) { - return (0, file_command_1.issueFileCommand)("STATE", (0, file_command_1.prepareKeyValueMessage)(name, value)); - } - (0, command_1.issueCommand)("save-state", { name }, (0, utils_1.toCommandValue)(value)); - } - function getState(name) { - return process.env[`STATE_${name}`] || ""; - } - function getIDToken(aud) { - return __awaiter2(this, void 0, void 0, function* () { - return yield oidc_utils_1.OidcClient.getIDToken(aud); - }); - } - var summary_1 = require_summary(); - Object.defineProperty(exports, "summary", { enumerable: true, get: function() { - return summary_1.summary; - } }); - var summary_2 = require_summary(); - Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function() { - return summary_2.markdownSummary; - } }); - var path_utils_1 = require_path_utils(); - Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function() { - return path_utils_1.toPosixPath; - } }); - Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function() { - return path_utils_1.toWin32Path; - } }); - Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function() { - return path_utils_1.toPlatformPath; - } }); - exports.platform = __importStar(require_platform()); } -}); - -// node_modules/fast-content-type-parse/index.js -var require_fast_content_type_parse = __commonJS({ - "node_modules/fast-content-type-parse/index.js"(exports, module) { - "use strict"; - var NullObject = function NullObject2() { - }; - NullObject.prototype = /* @__PURE__ */ Object.create(null); - var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu; - var quotedPairRE = /\\([\v\u0020-\u00ff])/gu; - var mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u; - var defaultContentType = { type: "", parameters: new NullObject() }; - Object.freeze(defaultContentType.parameters); - Object.freeze(defaultContentType); - function parse3(header) { - if (typeof header !== "string") { - throw new TypeError("argument header is required and must be a string"); - } - let index = header.indexOf(";"); - const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); - if (mediaTypeRE.test(type) === false) { - throw new TypeError("invalid media type"); - } - const result = { - type: type.toLowerCase(), - parameters: new NullObject() - }; - if (index === -1) { - return result; - } - let key; - let match; - let value; - paramRE.lastIndex = index; - while (match = paramRE.exec(header)) { - if (match.index !== index) { - throw new TypeError("invalid parameter format"); - } - index += match[0].length; - key = match[1].toLowerCase(); - value = match[2]; - if (value[0] === '"') { - value = value.slice(1, value.length - 1); - quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); - } - result.parameters[key] = value; - } - if (index !== header.length) { - throw new TypeError("invalid parameter format"); + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); } - return result; } - function safeParse2(header) { - if (typeof header !== "string") { - return defaultContentType; - } - let index = header.indexOf(";"); - const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); - if (mediaTypeRE.test(type) === false) { - return defaultContentType; + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); } - const result = { - type: type.toLowerCase(), - parameters: new NullObject() - }; - if (index === -1) { - return result; + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var { access, appendFile, writeFile } = promises; +var SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY"; +var Summary = class { + constructor() { + this._buffer = ""; + } + /** + * Finds the summary file path from the environment, rejects if env var is not found or file does not exist + * Also checks r/w permissions. + * + * @returns step summary file path + */ + filePath() { + return __awaiter(this, void 0, void 0, function* () { + if (this._filePath) { + return this._filePath; } - let key; - let match; - let value; - paramRE.lastIndex = index; - while (match = paramRE.exec(header)) { - if (match.index !== index) { - return defaultContentType; - } - index += match[0].length; - key = match[1].toLowerCase(); - value = match[2]; - if (value[0] === '"') { - value = value.slice(1, value.length - 1); - quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); - } - result.parameters[key] = value; + const pathFromEnv = process.env[SUMMARY_ENV_VAR]; + if (!pathFromEnv) { + throw new Error(`Unable to find environment variable for $${SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); } - if (index !== header.length) { - return defaultContentType; + try { + yield access(pathFromEnv, constants.R_OK | constants.W_OK); + } catch (_a) { + throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); } - return result; + this._filePath = pathFromEnv; + return this._filePath; + }); + } + /** + * Wraps content in an HTML tag, adding any HTML attributes + * + * @param {string} tag HTML tag to wrap + * @param {string | null} content content within the tag + * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add + * + * @returns {string} content wrapped in HTML element + */ + wrap(tag, content, attrs = {}) { + const htmlAttrs = Object.entries(attrs).map(([key, value]) => ` ${key}="${value}"`).join(""); + if (!content) { + return `<${tag}${htmlAttrs}>`; } - module.exports.default = { parse: parse3, safeParse: safeParse2 }; - module.exports.parse = parse3; - module.exports.safeParse = safeParse2; - module.exports.defaultContentType = defaultContentType; + return `<${tag}${htmlAttrs}>${content}`; } -}); + /** + * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. + * + * @param {SummaryWriteOptions} [options] (optional) options for write operation + * + * @returns {Promise} summary instance + */ + write(options) { + return __awaiter(this, void 0, void 0, function* () { + const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); + const filePath = yield this.filePath(); + const writeFunc = overwrite ? writeFile : appendFile; + yield writeFunc(filePath, this._buffer, { encoding: "utf8" }); + return this.emptyBuffer(); + }); + } + /** + * Clears the summary buffer and wipes the summary file + * + * @returns {Summary} summary instance + */ + clear() { + return __awaiter(this, void 0, void 0, function* () { + return this.emptyBuffer().write({ overwrite: true }); + }); + } + /** + * Returns the current summary buffer as a string + * + * @returns {string} string of summary buffer + */ + stringify() { + return this._buffer; + } + /** + * If the summary buffer is empty + * + * @returns {boolen} true if the buffer is empty + */ + isEmptyBuffer() { + return this._buffer.length === 0; + } + /** + * Resets the summary buffer without writing to summary file + * + * @returns {Summary} summary instance + */ + emptyBuffer() { + this._buffer = ""; + return this; + } + /** + * Adds raw text to the summary buffer + * + * @param {string} text content to add + * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) + * + * @returns {Summary} summary instance + */ + addRaw(text, addEOL = false) { + this._buffer += text; + return addEOL ? this.addEOL() : this; + } + /** + * Adds the operating system-specific end-of-line marker to the buffer + * + * @returns {Summary} summary instance + */ + addEOL() { + return this.addRaw(EOL3); + } + /** + * Adds an HTML codeblock to the summary buffer + * + * @param {string} code content to render within fenced code block + * @param {string} lang (optional) language to syntax highlight code + * + * @returns {Summary} summary instance + */ + addCodeBlock(code, lang) { + const attrs = Object.assign({}, lang && { lang }); + const element = this.wrap("pre", this.wrap("code", code), attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML list to the summary buffer + * + * @param {string[]} items list of items to render + * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) + * + * @returns {Summary} summary instance + */ + addList(items, ordered = false) { + const tag = ordered ? "ol" : "ul"; + const listItems = items.map((item) => this.wrap("li", item)).join(""); + const element = this.wrap(tag, listItems); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML table to the summary buffer + * + * @param {SummaryTableCell[]} rows table rows + * + * @returns {Summary} summary instance + */ + addTable(rows) { + const tableBody = rows.map((row) => { + const cells = row.map((cell) => { + if (typeof cell === "string") { + return this.wrap("td", cell); + } + const { header, data, colspan, rowspan } = cell; + const tag = header ? "th" : "td"; + const attrs = Object.assign(Object.assign({}, colspan && { colspan }), rowspan && { rowspan }); + return this.wrap(tag, data, attrs); + }).join(""); + return this.wrap("tr", cells); + }).join(""); + const element = this.wrap("table", tableBody); + return this.addRaw(element).addEOL(); + } + /** + * Adds a collapsable HTML details element to the summary buffer + * + * @param {string} label text for the closed state + * @param {string} content collapsable content + * + * @returns {Summary} summary instance + */ + addDetails(label, content) { + const element = this.wrap("details", this.wrap("summary", label) + content); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML image tag to the summary buffer + * + * @param {string} src path to the image you to embed + * @param {string} alt text description of the image + * @param {SummaryImageOptions} options (optional) addition image attributes + * + * @returns {Summary} summary instance + */ + addImage(src, alt, options) { + const { width, height } = options || {}; + const attrs = Object.assign(Object.assign({}, width && { width }), height && { height }); + const element = this.wrap("img", null, Object.assign({ src, alt }, attrs)); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML section heading element + * + * @param {string} text heading text + * @param {number | string} [level=1] (optional) the heading level, default: 1 + * + * @returns {Summary} summary instance + */ + addHeading(text, level) { + const tag = `h${level}`; + const allowedTag = ["h1", "h2", "h3", "h4", "h5", "h6"].includes(tag) ? tag : "h1"; + const element = this.wrap(allowedTag, text); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML thematic break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addSeparator() { + const element = this.wrap("hr", null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML line break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addBreak() { + const element = this.wrap("br", null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML blockquote to the summary buffer + * + * @param {string} text quote text + * @param {string} cite (optional) citation url + * + * @returns {Summary} summary instance + */ + addQuote(text, cite) { + const attrs = Object.assign({}, cite && { cite }); + const element = this.wrap("blockquote", text, attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML anchor tag to the summary buffer + * + * @param {string} text link text/content + * @param {string} href hyperlink + * + * @returns {Summary} summary instance + */ + addLink(text, href) { + const element = this.wrap("a", text, { href }); + return this.addRaw(element).addEOL(); + } +}; +var _summary = new Summary(); -// src/main.ts -var core7 = __toESM(require_core(), 1); -import * as process2 from "process"; +// node_modules/@actions/core/lib/platform.js +import os3 from "os"; + +// node_modules/@actions/io/lib/io-util.js +import * as fs2 from "fs"; +var { chmod, copyFile, lstat, mkdir, open, readdir, rename, rm, rmdir, stat, symlink, unlink } = fs2.promises; +var IS_WINDOWS = process.platform === "win32"; +var READONLY = fs2.constants.O_RDONLY; + +// node_modules/@actions/exec/lib/toolrunner.js +var IS_WINDOWS2 = process.platform === "win32"; + +// node_modules/@actions/core/lib/platform.js +var platform = os3.platform(); +var arch = os3.arch(); + +// node_modules/@actions/core/lib/core.js +var ExitCode; +(function(ExitCode2) { + ExitCode2[ExitCode2["Success"] = 0] = "Success"; + ExitCode2[ExitCode2["Failure"] = 1] = "Failure"; +})(ExitCode || (ExitCode = {})); +function getInput(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || ""; + if (options && options.required && !val) { + throw new Error(`Input required and not supplied: ${name}`); + } + if (options && options.trimWhitespace === false) { + return val; + } + return val.trim(); +} +function getBooleanInput(name, options) { + const trueValue = ["true", "True", "TRUE"]; + const falseValue = ["false", "False", "FALSE"]; + const val = getInput(name, options); + if (trueValue.includes(val)) + return true; + if (falseValue.includes(val)) + return false; + throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); +} +function setOutput(name, value) { + const filePath = process.env["GITHUB_OUTPUT"] || ""; + if (filePath) { + return issueFileCommand("OUTPUT", prepareKeyValueMessage(name, value)); + } + process.stdout.write(os4.EOL); + issueCommand("set-output", { name }, toCommandValue(value)); +} +function setFailed(message) { + process.exitCode = ExitCode.Failure; + error(message); +} +function error(message, properties = {}) { + issueCommand("error", toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +function info(message) { + process.stdout.write(message + os4.EOL); +} // node_modules/@actions/github/lib/context.js -import { readFileSync, existsSync } from "fs"; -import { EOL } from "os"; +import { readFileSync, existsSync as existsSync2 } from "fs"; +import { EOL as EOL5 } from "os"; var Context = class { /** * Hydrate the context from the environment @@ -21601,11 +19906,11 @@ var Context = class { var _a, _b, _c; this.payload = {}; if (process.env.GITHUB_EVENT_PATH) { - if (existsSync(process.env.GITHUB_EVENT_PATH)) { + if (existsSync2(process.env.GITHUB_EVENT_PATH)) { this.payload = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: "utf8" })); } else { const path2 = process.env.GITHUB_EVENT_PATH; - process.stdout.write(`GITHUB_EVENT_PATH ${path2} does not exist${EOL}`); + process.stdout.write(`GITHUB_EVENT_PATH ${path2} does not exist${EOL5}`); } } this.eventName = process.env.GITHUB_EVENT_NAME; @@ -21643,8 +19948,8 @@ var Context = class { // node_modules/@actions/github/lib/internal/utils.js var httpClient = __toESM(require_lib(), 1); -var import_undici = __toESM(require_undici(), 1); -var __awaiter = function(thisArg, _arguments, P, generator) { +var import_undici2 = __toESM(require_undici(), 1); +var __awaiter2 = function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); @@ -21689,8 +19994,8 @@ function getProxyAgentDispatcher(destinationUrl) { } function getProxyFetch(destinationUrl) { const httpDispatcher = getProxyAgentDispatcher(destinationUrl); - const proxyFetch = (url, opts) => __awaiter(this, void 0, void 0, function* () { - return (0, import_undici.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher })); + const proxyFetch = (url, opts) => __awaiter2(this, void 0, void 0, function* () { + return (0, import_undici2.fetch)(url, Object.assign(Object.assign({}, opts), { dispatcher: httpDispatcher })); }); return proxyFetch; } @@ -21756,8 +20061,8 @@ function addHook(state, kind, name, hook2) { } if (kind === "error") { hook2 = (method, options) => { - return Promise.resolve().then(method.bind(null, options)).catch((error3) => { - return orig(error3, options); + return Promise.resolve().then(method.bind(null, options)).catch((error2) => { + return orig(error2, options); }); }; } @@ -22214,26 +20519,26 @@ async function fetchWrapper(requestOptions) { // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex. ...requestOptions.body && { duplex: "half" } }); - } catch (error3) { + } catch (error2) { let message = "Unknown Error"; - if (error3 instanceof Error) { - if (error3.name === "AbortError") { - error3.status = 500; - throw error3; + if (error2 instanceof Error) { + if (error2.name === "AbortError") { + error2.status = 500; + throw error2; } - message = error3.message; - if (error3.name === "TypeError" && "cause" in error3) { - if (error3.cause instanceof Error) { - message = error3.cause.message; - } else if (typeof error3.cause === "string") { - message = error3.cause; + message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; } } } const requestError = new RequestError(message, 500, { request: requestOptions }); - requestError.cause = error3; + requestError.cause = error2; throw requestError; } const status = fetchResponse.status; @@ -25131,8 +23436,8 @@ function iterator(octokit, route, parameters) { } } return { value: normalizedResponse }; - } catch (error3) { - if (error3.status !== 409) throw error3; + } catch (error2) { + if (error2.status !== 409) throw error2; url = ""; return { value: { @@ -25757,7 +24062,7 @@ function parse2(input, typeOrFileName, packageJson) { } // src/lockfile.ts -import { existsSync as existsSync2 } from "node:fs"; +import { existsSync as existsSync3 } from "node:fs"; import { join } from "node:path"; var supportedLockfiles = [ "pnpm-lock.yaml", @@ -25775,7 +24080,7 @@ function computeDependencyVersions(lockFile) { } function detectLockfile(workspacePath) { for (const c of supportedLockfiles) { - if (existsSync2(join(workspacePath, c))) return c; + if (existsSync3(join(workspacePath, c))) return c; } return void 0; } @@ -25789,7 +24094,6 @@ function addVersion(map, name, version) { } // src/git.ts -var core = __toESM(require_core(), 1); import { execFileSync } from "child_process"; function getFileFromRef(ref, filePath, cwd2) { const refFilePath = `${ref}:${filePath}`; @@ -25801,7 +24105,7 @@ function getFileFromRef(ref, filePath, cwd2) { maxBuffer: 1024 * 1024 * 100 }); } catch (e) { - core.error(`Failed to get file from ref "${refFilePath}": ${e}`); + error(`Failed to get file from ref "${refFilePath}": ${e}`); return null; } } @@ -25812,14 +24116,14 @@ function tryGetJSONFromRef(ref, filePath, cwd2) { return JSON.parse(content); } catch (e) { const refFilePath = `${ref}:${filePath}`; - core.error(`Failed to get json from ref "${refFilePath}": ${e}`); + error(`Failed to get json from ref "${refFilePath}": ${e}`); return null; } } return null; } function getBaseRef() { - const inputBaseRef = core.getInput("base-ref"); + const inputBaseRef = getInput("base-ref"); if (inputBaseRef) { return inputBaseRef.includes("/") ? inputBaseRef : `origin/${inputBaseRef}`; } @@ -25831,7 +24135,6 @@ function getBaseRef() { } // src/npm.ts -var core2 = __toESM(require_core(), 1); function getProvenance(meta) { if (meta._npmUser?.trustedPublisher) { return "trusted-with-provenance"; @@ -25886,7 +24189,7 @@ async function fetchPackageMetadataImmediate(packageName, version) { } return await response.json(); } catch (err) { - core2.info(`Failed to fetch metadata for ${packageName}@${version}: ${err}`); + info(`Failed to fetch metadata for ${packageName}@${version}: ${err}`); return null; } } @@ -25915,17 +24218,17 @@ async function calculateTotalDependencySizeIncrease(newVersions, removedVersions const metadata = await fetchPackageMetadata(dep.name, dep.version); if (!metadata || metadata.dist?.unpackedSize === void 0) { packageSizes.set(packageKey, null); - core2.info(`No unpacked size info for ${packageKey}, skipping`); + info(`No unpacked size info for ${packageKey}, skipping`); } else { totalSize += metadata.dist.unpackedSize; packageSizes.set(packageKey, metadata.dist.unpackedSize); - core2.info( + info( `Added ${metadata.dist.unpackedSize} bytes for ${packageKey}` ); } processedPackages.add(packageKey); } catch (e) { - core2.error( + error( `Error fetching package metadata for dep ${packageKey}: ` + e.message ); } @@ -25939,17 +24242,17 @@ async function calculateTotalDependencySizeIncrease(newVersions, removedVersions const metadata = await fetchPackageMetadata(dep.name, dep.version); if (!metadata || metadata.dist?.unpackedSize === void 0) { packageSizes.set(packageKey, null); - core2.info(`No unpacked size info for ${packageKey}, skipping`); + info(`No unpacked size info for ${packageKey}, skipping`); } else { totalSize -= metadata.dist.unpackedSize; packageSizes.set(packageKey, -metadata.dist.unpackedSize); - core2.info( + info( `Subtracted ${metadata.dist.unpackedSize} bytes for ${packageKey}` ); } processedPackages.add(packageKey); } catch (e) { - core2.error( + error( `Error fetching package metadata for dep ${packageKey}: ` + e.message ); } @@ -25978,16 +24281,15 @@ function getDependenciesFromPackageJson(pkg, types) { } return result; } -function isSupportedArchitecture(pkg, os, cpu, libc) { - const osMatches = pkg.os === void 0 || pkg.os.length === 0 || pkg.os.includes(os); +function isSupportedArchitecture(pkg, os5, cpu, libc) { + const osMatches = pkg.os === void 0 || pkg.os.length === 0 || pkg.os.includes(os5); const cpuMatches = pkg.cpu === void 0 || pkg.cpu.length === 0 || pkg.cpu.includes(cpu); const libcMatches = pkg.libc === void 0 || pkg.libc.length === 0 || pkg.libc.includes(libc); return osMatches && cpuMatches && libcMatches; } // src/packs.ts -var core3 = __toESM(require_core(), 1); -import * as fs from "node:fs/promises"; +import * as fs3 from "node:fs/promises"; import * as path from "path"; import { createReadStream } from "node:fs"; import { createGunzip } from "node:zlib"; @@ -26029,7 +24331,7 @@ async function extractPackageNameFromTgz(filePath) { const packageJson = JSON.parse(packageJsonContent); return packageJson.name ?? null; } catch (err) { - core3.info(`Failed to parse package.json in ${filePath}: ${err}`); + info(`Failed to parse package.json in ${filePath}: ${err}`); return null; } } @@ -26040,22 +24342,22 @@ async function extractPackageNameFromTgz(filePath) { } return null; } catch (err) { - core3.info(`Failed to extract package name from ${filePath}: ${err}`); + info(`Failed to extract package name from ${filePath}: ${err}`); return null; } } async function getPacksFromPattern(pattern) { try { const packs = []; - for await (const filePath of fs.glob(pattern)) { + for await (const filePath of fs3.glob(pattern)) { if (!filePath.endsWith(".tgz") && !filePath.endsWith(".tar.gz")) { continue; } - const stats = await fs.stat(filePath); + const stats = await fs3.stat(filePath); const name = path.basename(filePath); const packageName = await extractPackageNameFromTgz(filePath); if (!packageName) { - core3.info( + info( `Warning: Skipping ${name} - could not extract package name from tgz file` ); continue; @@ -26069,7 +24371,7 @@ async function getPacksFromPattern(pattern) { } return packs.sort((a, b) => a.name.localeCompare(b.name)); } catch (err) { - core3.info(`Failed to get packs from pattern "${pattern}": ${err}`); + info(`Failed to get packs from pattern "${pattern}": ${err}`); return []; } } @@ -26280,7 +24582,6 @@ ${duplicateRows.join("\n")}${helpMessage}` } // src/checks/dependency-count.ts -var core4 = __toESM(require_core(), 1); function scanForDependencyCount(messages, threshold, currentDeps, baseDeps) { const currentDepCount = Array.from(currentDeps.values()).reduce( (sum, versions) => sum + versions.size, @@ -26291,9 +24592,9 @@ function scanForDependencyCount(messages, threshold, currentDeps, baseDeps) { 0 ); const depIncrease = currentDepCount - baseDepCount; - core4.info(`Base dependency count: ${baseDepCount}`); - core4.info(`Current dependency count: ${currentDepCount}`); - core4.info(`Dependency count increase: ${depIncrease}`); + info(`Base dependency count: ${baseDepCount}`); + info(`Current dependency count: ${currentDepCount}`); + info(`Dependency count increase: ${depIncrease}`); if (depIncrease >= threshold) { messages.push( `## \u26A0\uFE0F Dependency Count @@ -26303,9 +24604,6 @@ This PR adds ${depIncrease} new dependencies (${baseDepCount} \u2192 ${currentDe } } -// src/checks/dependency-size.ts -var core5 = __toESM(require_core(), 1); - // src/common.ts function formatBytes(bytes) { if (bytes === 0) return "0 B"; @@ -26421,8 +24719,8 @@ async function scanForDependencySize(messages, threshold, currentDeps, baseDeps, if (removedVersions.length > 0) { await removeUnsupportedOptionalDependencies(baseLockFile, removedVersions); } - core5.info(`Found ${newVersions.length} new package versions`); - core5.info(`Found ${removedVersions.length} removed package versions.`); + info(`Found ${newVersions.length} new package versions`); + info(`Found ${removedVersions.length} removed package versions.`); if (newVersions.length === 0 && removedVersions.length === 0) { return; } @@ -26431,7 +24729,7 @@ async function scanForDependencySize(messages, threshold, currentDeps, baseDeps, newVersions, removedVersions ); - core5.info( + info( `Total dependency size increase: ${sizeData ? formatBytes(sizeData.totalSize) : "unknown"}` ); const shouldShow = threshold === -1 || sizeData !== null && sizeData.totalSize >= threshold; @@ -26464,12 +24762,11 @@ ${packageRows} ); } } catch (err) { - core5.info(`Failed to calculate total dependency size increase: ${err}`); + info(`Failed to calculate total dependency size increase: ${err}`); } } // src/checks/provenance.ts -var core6 = __toESM(require_core(), 1); async function scanForProvenance(messages, currentDeps, baseDeps) { const provenanceRows = []; for (const [packageName, currentVersionSet] of currentDeps) { @@ -26500,7 +24797,7 @@ async function scanForProvenance(messages, currentDeps, baseDeps) { ); } } catch (err) { - core6.info(`Failed to check provenance for ${packageName}: ${err}`); + info(`Failed to check provenance for ${packageName}: ${err}`); } } if (provenanceRows.length > 0) { @@ -26545,243 +24842,273 @@ ${packRows}` } } -// src/main.ts +// src/constants.ts var COMMENT_TAG = ""; -async function run() { - try { - const baseWorkspace = process2.env.GITHUB_WORKSPACE || process2.cwd(); - const workDir = core7.getInput("working-directory") || "."; - const workspacePath = join2(baseWorkspace, workDir); - core7.info(`Workspace path is ${workspacePath}`); - const baseRef = getBaseRef(); - const currentRef = context2.payload.pull_reuqest?.head.sha ?? context2.sha; - const lockfileFilename = detectLockfile(workspacePath); - core7.info(`Detected lockfile ${lockfileFilename}`); - const token = core7.getInput("github-token", { required: true }); - const prNumber = parseInt(core7.getInput("pr-number", { required: true }), 10); - const detectReplacements = core7.getBooleanInput("detect-replacements"); - const dependencyThreshold = parseInt( - core7.getInput("dependency-threshold") || "10", - 10 - ); - const sizeThreshold = parseInt( - core7.getInput("size-threshold") || "100000", - 10 - ); - const duplicateThreshold = parseInt( - core7.getInput("duplicate-threshold") || "1", - 10 - ); - const packSizeThreshold = parseInt( - core7.getInput("pack-size-threshold") || "50000", - 10 +var ARTIFACT_FILENAME = "e18e-diff-result.json"; + +// src/github.ts +async function findExistingComment(octokit, prNumber) { + const { owner, repo } = context2.repo; + const perPage = 100; + for await (const { data: comments } of octokit.paginate.iterator( + octokit.rest.issues.listComments, + { + owner, + repo, + issue_number: prNumber, + per_page: perPage + } + )) { + const comment = comments.find( + (c) => c.user && c.user.login === "github-actions[bot]" && c.body?.includes(COMMENT_TAG) ); - if (Number.isNaN(prNumber) || prNumber < 1) { - core7.info("No valid pull request number was found. Skipping."); - return; + if (comment) { + return comment.id; } - if (!lockfileFilename) { - core7.info("No lockfile detected in the workspace. Exiting."); - return; - } - const lockfilePath = join2(workDir, lockfileFilename); - const packageFilePath = join2(workDir, "package.json"); - core7.info(`Using lockfile: ${lockfilePath}`); - core7.info( - `Comparing package lockfiles between ${baseRef} and ${currentRef}` + } + return void 0; +} +async function upsertComment(octokit, prNumber, body) { + const { owner, repo } = context2.repo; + const existingCommentId = await findExistingComment(octokit, prNumber); + if (existingCommentId) { + await octokit.rest.issues.updateComment({ + owner, + repo, + comment_id: existingCommentId, + body + }); + info(`Updated existing dependency diff comment #${existingCommentId}`); + } else { + await octokit.rest.issues.createComment({ + owner, + repo, + issue_number: prNumber, + body + }); + info("Created new dependency diff comment"); + } +} + +// src/main.ts +async function postCommentFromArtifact() { + const token = getInput("github-token", { required: true }); + const artifactPath = getInput("artifact-path"); + if (!artifactPath) { + setFailed( + "No artifact-path was provided. This is required for comment-from-artifact mode." ); - const basePackageLock = getFileFromRef( - baseRef, - lockfilePath, - baseWorkspace + return; + } + info(`Reading artifact from ${artifactPath}`); + const result = JSON.parse( + await fs4.readFile(artifactPath, "utf-8") + ); + info(`Posting comment to PR #${result.pr_number}`); + const octokit = getOctokit(token); + await upsertComment(octokit, result.pr_number, result.body); +} +async function analyzeAndComment() { + const baseWorkspace = process2.env.GITHUB_WORKSPACE || process2.cwd(); + const mode = getInput("mode") || "comment"; + const workDir = getInput("working-directory") || "."; + const workspacePath = join2(baseWorkspace, workDir); + info(`Workspace path is ${workspacePath}`); + const baseRef = getBaseRef(); + const currentRef = context2.payload.pull_reuqest?.head.sha ?? context2.sha; + const lockfileFilename = detectLockfile(workspacePath); + info(`Detected lockfile ${lockfileFilename}`); + const token = getInput("github-token", { required: true }); + const prNumber = parseInt(getInput("pr-number", { required: true }), 10); + const detectReplacements = getBooleanInput("detect-replacements"); + const dependencyThreshold = parseInt( + getInput("dependency-threshold") || "10", + 10 + ); + const sizeThreshold = parseInt( + getInput("size-threshold") || "100000", + 10 + ); + const duplicateThreshold = parseInt( + getInput("duplicate-threshold") || "1", + 10 + ); + const packSizeThreshold = parseInt( + getInput("pack-size-threshold") || "50000", + 10 + ); + if (Number.isNaN(prNumber) || prNumber < 1) { + info("No valid pull request number was found. Skipping."); + return; + } + if (!lockfileFilename) { + info("No lockfile detected in the workspace. Exiting."); + return; + } + const lockfilePath = join2(workDir, lockfileFilename); + const packageFilePath = join2(workDir, "package.json"); + info(`Using lockfile: ${lockfilePath}`); + info(`Comparing package lockfiles between ${baseRef} and ${currentRef}`); + const basePackageLock = getFileFromRef(baseRef, lockfilePath, baseWorkspace); + if (!basePackageLock) { + info("No package lockfile found in base ref"); + return; + } + const currentPackageLock = getFileFromRef( + currentRef, + lockfilePath, + baseWorkspace + ); + if (!currentPackageLock) { + info("No package lockfile found in current ref"); + return; + } + const basePackageJson = tryGetJSONFromRef( + baseRef, + packageFilePath, + workspacePath + ); + const currentPackageJson = tryGetJSONFromRef( + currentRef, + packageFilePath, + workspacePath + ); + let parsedCurrentLock; + let parsedBaseLock; + try { + parsedCurrentLock = await parse2( + currentPackageLock, + lockfileFilename, + currentPackageJson ?? void 0 ); - if (!basePackageLock) { - core7.info("No package lockfile found in base ref"); - return; - } - const currentPackageLock = getFileFromRef( - currentRef, - lockfilePath, - baseWorkspace + info( + `Parsed current lockfile with ${parsedCurrentLock.packages.length} packages` ); - if (!currentPackageLock) { - core7.info("No package lockfile found in current ref"); - return; - } - const basePackageJson = tryGetJSONFromRef( - baseRef, - packageFilePath, - workspacePath + } catch (err) { + setFailed(`Failed to parse current lockfile: ${err}`); + return; + } + try { + parsedBaseLock = await parse2( + basePackageLock, + lockfileFilename, + basePackageJson ?? void 0 ); - const currentPackageJson = tryGetJSONFromRef( - currentRef, - packageFilePath, - workspacePath + info( + `Parsed base lockfile with ${parsedBaseLock.packages.length} packages` ); - let parsedCurrentLock; - let parsedBaseLock; + } catch (err) { + setFailed(`Failed to parse base lockfile: ${err}`); + return; + } + const currentDeps = computeDependencyVersions(parsedCurrentLock); + const baseDeps = computeDependencyVersions(parsedBaseLock); + info(`Dependency threshold set to ${dependencyThreshold}`); + info(`Size threshold set to ${formatBytes(sizeThreshold)}`); + info(`Duplicate threshold set to ${duplicateThreshold}`); + info(`Pack size threshold set to ${formatBytes(packSizeThreshold)}`); + const messages = []; + scanForDependencyCount(messages, dependencyThreshold, currentDeps, baseDeps); + scanForDuplicates( + messages, + duplicateThreshold, + currentDeps, + lockfilePath, + parsedCurrentLock + ); + await scanForDependencySize( + messages, + sizeThreshold, + currentDeps, + baseDeps, + parsedCurrentLock, + parsedBaseLock + ); + await scanForProvenance(messages, currentDeps, baseDeps); + const basePackagesPattern = getInput("base-packages"); + const sourcePackagesPattern = getInput("source-packages"); + if (basePackagesPattern && sourcePackagesPattern) { try { - parsedCurrentLock = await parse2( - currentPackageLock, - lockfileFilename, - currentPackageJson ?? void 0 + info( + `Comparing pack sizes between patterns: ${basePackagesPattern} and ${sourcePackagesPattern}` + ); + const basePacks = await getPacksFromPattern(basePackagesPattern); + const sourcePacks = await getPacksFromPattern(sourcePackagesPattern); + info( + `Found ${basePacks.length} base packs and ${sourcePacks.length} source packs` ); - core7.info( - `Parsed current lockfile with ${parsedCurrentLock.packages.length} packages` + await scanForBundleSize( + messages, + basePacks, + sourcePacks, + packSizeThreshold ); } catch (err) { - core7.setFailed(`Failed to parse current lockfile: ${err}`); - return; + info(`Failed to compare pack sizes: ${err}`); } - try { - parsedBaseLock = await parse2( - basePackageLock, - lockfileFilename, - basePackageJson ?? void 0 - ); - core7.info( - `Parsed base lockfile with ${parsedBaseLock.packages.length} packages` + } + if (detectReplacements) { + if (!basePackageJson || !currentPackageJson) { + setFailed( + "detect-replacements requires both base and current package.json to be present" ); - } catch (err) { - core7.setFailed(`Failed to parse base lockfile: ${err}`); return; } - const currentDeps = computeDependencyVersions(parsedCurrentLock); - const baseDeps = computeDependencyVersions(parsedBaseLock); - core7.info(`Dependency threshold set to ${dependencyThreshold}`); - core7.info(`Size threshold set to ${formatBytes(sizeThreshold)}`); - core7.info(`Duplicate threshold set to ${duplicateThreshold}`); - core7.info(`Pack size threshold set to ${formatBytes(packSizeThreshold)}`); - const messages = []; - scanForDependencyCount( - messages, - dependencyThreshold, - currentDeps, - baseDeps - ); - scanForDuplicates( - messages, - duplicateThreshold, - currentDeps, - lockfilePath, - parsedCurrentLock - ); - await scanForDependencySize( - messages, - sizeThreshold, - currentDeps, - baseDeps, - parsedCurrentLock, - parsedBaseLock + const baseDependencies = getDependenciesFromPackageJson(basePackageJson, [ + "optional", + "peer", + "dev", + "prod" + ]); + const currentDependencies = getDependenciesFromPackageJson( + currentPackageJson, + ["optional", "peer", "dev", "prod"] ); - await scanForProvenance(messages, currentDeps, baseDeps); - const basePackagesPattern = core7.getInput("base-packages"); - const sourcePackagesPattern = core7.getInput("source-packages"); - if (basePackagesPattern && sourcePackagesPattern) { - try { - core7.info( - `Comparing pack sizes between patterns: ${basePackagesPattern} and ${sourcePackagesPattern}` - ); - const basePacks = await getPacksFromPattern(basePackagesPattern); - const sourcePacks = await getPacksFromPattern(sourcePackagesPattern); - core7.info( - `Found ${basePacks.length} base packs and ${sourcePacks.length} source packs` - ); - await scanForBundleSize( - messages, - basePacks, - sourcePacks, - packSizeThreshold - ); - } catch (err) { - core7.info(`Failed to compare pack sizes: ${err}`); - } - } - if (detectReplacements) { - if (!basePackageJson || !currentPackageJson) { - core7.setFailed( - "detect-replacements requires both base and current package.json to be present" - ); - return; - } - const baseDependencies = getDependenciesFromPackageJson(basePackageJson, [ - "optional", - "peer", - "dev", - "prod" - ]); - const currentDependencies = getDependenciesFromPackageJson( - currentPackageJson, - ["optional", "peer", "dev", "prod"] - ); - scanForReplacements(messages, baseDependencies, currentDependencies); - } - const octokit = getOctokit(token); - let existingCommentId = void 0; - const perPage = 100; - for await (const { data: comments } of octokit.paginate.iterator( - octokit.rest.issues.listComments, - { - owner: context2.repo.owner, - repo: context2.repo.repo, - issue_number: prNumber, - per_page: perPage - } - )) { - const comment = comments.find( - (c) => c.user && c.user.login === "github-actions[bot]" && c.body?.includes(COMMENT_TAG) - ); - if (comment) { - existingCommentId = comment.id; - break; - } - } - if (messages.length === 0) { - if (existingCommentId) { - await octokit.rest.issues.updateComment({ - owner: context2.repo.owner, - repo: context2.repo.repo, - comment_id: existingCommentId, - body: `${COMMENT_TAG} + scanForReplacements(messages, baseDependencies, currentDependencies); + } + const commentBody = messages.length === 0 ? `${COMMENT_TAG} ## e18e dependency analysis No dependency warnings found. -` - }); - core7.info( - `Updated existing dependency diff comment #${existingCommentId}` - ); - } else { - core7.info("No dependency warnings found. Skipping comment creation."); - } - return; - } - const finalCommentBody = `${COMMENT_TAG} +` : `${COMMENT_TAG} ${messages.join("\n\n")}`; + if (mode === "artifact") { + const tmpDir = join2(baseWorkspace, ".e18e-tmp"); + const outputPath = join2(tmpDir, ARTIFACT_FILENAME); + await fs4.mkdir(tmpDir, { recursive: true }); + await fs4.writeFile( + outputPath, + JSON.stringify({ pr_number: prNumber, body: commentBody }) + ); + setOutput("artifact-path", outputPath); + info(`Wrote artifact to ${outputPath}`); + return; + } + const octokit = getOctokit(token); + if (messages.length === 0) { + const existingCommentId = await findExistingComment(octokit, prNumber); if (existingCommentId) { - await octokit.rest.issues.updateComment({ - owner: context2.repo.owner, - repo: context2.repo.repo, - comment_id: existingCommentId, - body: finalCommentBody - }); - core7.info( - `Updated existing dependency diff comment #${existingCommentId}` - ); + await upsertComment(octokit, prNumber, commentBody); } else { - await octokit.rest.issues.createComment({ - owner: context2.repo.owner, - repo: context2.repo.repo, - issue_number: prNumber, - body: finalCommentBody - }); - core7.info("Created new dependency diff comment"); + info("No dependency warnings found. Skipping comment creation."); + } + return; + } + await upsertComment(octokit, prNumber, commentBody); +} +async function run() { + try { + const mode = getInput("mode") || "comment"; + if (mode === "comment-from-artifact") { + await postCommentFromArtifact(); + return; } - } catch (error3) { - if (error3 instanceof Error) { - core7.setFailed(error3.message); + await analyzeAndComment(); + } catch (error2) { + if (error2 instanceof Error) { + setFailed(error2.message); } else { - core7.setFailed("An unknown error occurred."); + setFailed("An unknown error occurred."); } } } diff --git a/recipes/artifact/analyze.yml b/recipes/artifact/analyze.yml new file mode 100644 index 0000000..780c8d1 --- /dev/null +++ b/recipes/artifact/analyze.yml @@ -0,0 +1,25 @@ +name: Dependency Diff (Analyze) + +on: + pull_request: + +jobs: + diff_dependencies: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Analyze Dependencies + id: analyze + uses: e18e/action-dependency-diff@v1 + with: + mode: artifact + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: e18e-diff-result + path: ${{ steps.analyze.outputs.artifact-path }} diff --git a/recipes/artifact/comment.yml b/recipes/artifact/comment.yml new file mode 100644 index 0000000..632ecf7 --- /dev/null +++ b/recipes/artifact/comment.yml @@ -0,0 +1,27 @@ +name: Dependency Diff (Comment) + +on: + workflow_run: + workflows: ['Dependency Diff (Analyze)'] + types: + - completed + +jobs: + post_comment: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + permissions: + pull-requests: write + actions: read + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: e18e-diff-result + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Post Comment + uses: e18e/action-dependency-diff@v1 + with: + mode: comment-from-artifact + artifact-path: e18e-diff-result.json diff --git a/recipes/basic.yml b/recipes/basic/workflow.yml similarity index 100% rename from recipes/basic.yml rename to recipes/basic/workflow.yml diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..0c7f2ca --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,2 @@ +export const COMMENT_TAG = ''; +export const ARTIFACT_FILENAME = 'e18e-diff-result.json'; diff --git a/src/github.ts b/src/github.ts new file mode 100644 index 0000000..30b18cb --- /dev/null +++ b/src/github.ts @@ -0,0 +1,62 @@ +import * as github from '@actions/github'; +import * as core from '@actions/core'; +import {COMMENT_TAG} from './constants.js'; + +type Octokit = ReturnType; + +export async function findExistingComment( + octokit: Octokit, + prNumber: number +): Promise { + const {owner, repo} = github.context.repo; + const perPage = 100; + + for await (const {data: comments} of octokit.paginate.iterator( + octokit.rest.issues.listComments, + { + owner, + repo, + issue_number: prNumber, + per_page: perPage + } + )) { + const comment = comments.find( + (c) => + c.user && + c.user.login === 'github-actions[bot]' && + c.body?.includes(COMMENT_TAG) + ); + if (comment) { + return comment.id; + } + } + + return undefined; +} + +export async function upsertComment( + octokit: Octokit, + prNumber: number, + body: string +): Promise { + const {owner, repo} = github.context.repo; + const existingCommentId = await findExistingComment(octokit, prNumber); + + if (existingCommentId) { + await octokit.rest.issues.updateComment({ + owner, + repo, + comment_id: existingCommentId, + body + }); + core.info(`Updated existing dependency diff comment #${existingCommentId}`); + } else { + await octokit.rest.issues.createComment({ + owner, + repo, + issue_number: prNumber, + body + }); + core.info('Created new dependency diff comment'); + } +} diff --git a/src/main.ts b/src/main.ts index fcaa252..107d01a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import * as process from 'process'; +import * as fs from 'node:fs/promises'; import * as core from '@actions/core'; import * as github from '@actions/github'; import type {PackageJson} from 'pkg-types'; @@ -15,268 +16,265 @@ import {scanForDependencySize} from './checks/dependency-size.js'; import {scanForProvenance} from './checks/provenance.js'; import {scanForBundleSize} from './checks/bundle-size.js'; import {formatBytes} from './common.js'; +import {ARTIFACT_FILENAME, COMMENT_TAG} from './constants.js'; +import {findExistingComment, upsertComment} from './github.js'; -const COMMENT_TAG = ''; +interface ArtifactResult { + pr_number: number; + body: string; +} + +async function postCommentFromArtifact(): Promise { + const token = core.getInput('github-token', {required: true}); + const artifactPath = core.getInput('artifact-path'); + + if (!artifactPath) { + core.setFailed( + 'No artifact-path was provided. This is required for comment-from-artifact mode.' + ); + return; + } + + core.info(`Reading artifact from ${artifactPath}`); + + const result: ArtifactResult = JSON.parse( + await fs.readFile(artifactPath, 'utf-8') + ); + + core.info(`Posting comment to PR #${result.pr_number}`); + + const octokit = github.getOctokit(token); + await upsertComment(octokit, result.pr_number, result.body); +} + +async function analyzeAndComment(): Promise { + const baseWorkspace = process.env.GITHUB_WORKSPACE || process.cwd(); + const mode = core.getInput('mode') || 'comment'; + const workDir = core.getInput('working-directory') || '.'; + const workspacePath = join(baseWorkspace, workDir); + core.info(`Workspace path is ${workspacePath}`); + + const baseRef = getBaseRef(); + const currentRef = + github.context.payload.pull_reuqest?.head.sha ?? github.context.sha; + const lockfileFilename = detectLockfile(workspacePath); + core.info(`Detected lockfile ${lockfileFilename}`); + + const token = core.getInput('github-token', {required: true}); + const prNumber = parseInt(core.getInput('pr-number', {required: true}), 10); + const detectReplacements = core.getBooleanInput('detect-replacements'); + const dependencyThreshold = parseInt( + core.getInput('dependency-threshold') || '10', + 10 + ); + const sizeThreshold = parseInt( + core.getInput('size-threshold') || '100000', + 10 + ); + const duplicateThreshold = parseInt( + core.getInput('duplicate-threshold') || '1', + 10 + ); + const packSizeThreshold = parseInt( + core.getInput('pack-size-threshold') || '50000', + 10 + ); + + if (Number.isNaN(prNumber) || prNumber < 1) { + core.info('No valid pull request number was found. Skipping.'); + return; + } + + if (!lockfileFilename) { + core.info('No lockfile detected in the workspace. Exiting.'); + return; + } + const lockfilePath = join(workDir, lockfileFilename); + const packageFilePath = join(workDir, 'package.json'); + core.info(`Using lockfile: ${lockfilePath}`); + + core.info(`Comparing package lockfiles between ${baseRef} and ${currentRef}`); + + const basePackageLock = getFileFromRef(baseRef, lockfilePath, baseWorkspace); + if (!basePackageLock) { + core.info('No package lockfile found in base ref'); + return; + } + + const currentPackageLock = getFileFromRef( + currentRef, + lockfilePath, + baseWorkspace + ); + if (!currentPackageLock) { + core.info('No package lockfile found in current ref'); + return; + } + + const basePackageJson = tryGetJSONFromRef( + baseRef, + packageFilePath, + workspacePath + ); + const currentPackageJson = tryGetJSONFromRef( + currentRef, + packageFilePath, + workspacePath + ); + + let parsedCurrentLock: ParsedLockFile; + let parsedBaseLock: ParsedLockFile; -async function run(): Promise { try { - const baseWorkspace = process.env.GITHUB_WORKSPACE || process.cwd(); - const workDir = core.getInput('working-directory') || '.'; - const workspacePath = join(baseWorkspace, workDir); - core.info(`Workspace path is ${workspacePath}`); - - const baseRef = getBaseRef(); - const currentRef = - github.context.payload.pull_reuqest?.head.sha ?? github.context.sha; - const lockfileFilename = detectLockfile(workspacePath); - core.info(`Detected lockfile ${lockfileFilename}`); - - const token = core.getInput('github-token', {required: true}); - const prNumber = parseInt(core.getInput('pr-number', {required: true}), 10); - const detectReplacements = core.getBooleanInput('detect-replacements'); - const dependencyThreshold = parseInt( - core.getInput('dependency-threshold') || '10', - 10 + parsedCurrentLock = await parseLockfile( + currentPackageLock, + lockfileFilename, + currentPackageJson ?? undefined ); - const sizeThreshold = parseInt( - core.getInput('size-threshold') || '100000', - 10 + core.info( + `Parsed current lockfile with ${parsedCurrentLock.packages.length} packages` ); - const duplicateThreshold = parseInt( - core.getInput('duplicate-threshold') || '1', - 10 + } catch (err) { + core.setFailed(`Failed to parse current lockfile: ${err}`); + return; + } + try { + parsedBaseLock = await parseLockfile( + basePackageLock, + lockfileFilename, + basePackageJson ?? undefined ); - const packSizeThreshold = parseInt( - core.getInput('pack-size-threshold') || '50000', - 10 + core.info( + `Parsed base lockfile with ${parsedBaseLock.packages.length} packages` ); + } catch (err) { + core.setFailed(`Failed to parse base lockfile: ${err}`); + return; + } - if (Number.isNaN(prNumber) || prNumber < 1) { - core.info('No valid pull request number was found. Skipping.'); - return; - } - - if (!lockfileFilename) { - core.info('No lockfile detected in the workspace. Exiting.'); - return; - } - const lockfilePath = join(workDir, lockfileFilename); - const packageFilePath = join(workDir, 'package.json'); - core.info(`Using lockfile: ${lockfilePath}`); + const currentDeps = computeDependencyVersions(parsedCurrentLock); + const baseDeps = computeDependencyVersions(parsedBaseLock); - core.info( - `Comparing package lockfiles between ${baseRef} and ${currentRef}` - ); + core.info(`Dependency threshold set to ${dependencyThreshold}`); + core.info(`Size threshold set to ${formatBytes(sizeThreshold)}`); + core.info(`Duplicate threshold set to ${duplicateThreshold}`); + core.info(`Pack size threshold set to ${formatBytes(packSizeThreshold)}`); - const basePackageLock = getFileFromRef( - baseRef, - lockfilePath, - baseWorkspace - ); - if (!basePackageLock) { - core.info('No package lockfile found in base ref'); - return; - } + const messages: string[] = []; - const currentPackageLock = getFileFromRef( - currentRef, - lockfilePath, - baseWorkspace - ); - if (!currentPackageLock) { - core.info('No package lockfile found in current ref'); - return; - } + scanForDependencyCount(messages, dependencyThreshold, currentDeps, baseDeps); + scanForDuplicates( + messages, + duplicateThreshold, + currentDeps, + lockfilePath, + parsedCurrentLock + ); - const basePackageJson = tryGetJSONFromRef( - baseRef, - packageFilePath, - workspacePath - ); - const currentPackageJson = tryGetJSONFromRef( - currentRef, - packageFilePath, - workspacePath - ); + await scanForDependencySize( + messages, + sizeThreshold, + currentDeps, + baseDeps, + parsedCurrentLock, + parsedBaseLock + ); + await scanForProvenance(messages, currentDeps, baseDeps); - let parsedCurrentLock: ParsedLockFile; - let parsedBaseLock: ParsedLockFile; + const basePackagesPattern = core.getInput('base-packages'); + const sourcePackagesPattern = core.getInput('source-packages'); + if (basePackagesPattern && sourcePackagesPattern) { try { - parsedCurrentLock = await parseLockfile( - currentPackageLock, - lockfileFilename, - currentPackageJson ?? undefined + core.info( + `Comparing pack sizes between patterns: ${basePackagesPattern} and ${sourcePackagesPattern}` ); + + const basePacks = await getPacksFromPattern(basePackagesPattern); + const sourcePacks = await getPacksFromPattern(sourcePackagesPattern); + core.info( - `Parsed current lockfile with ${parsedCurrentLock.packages.length} packages` + `Found ${basePacks.length} base packs and ${sourcePacks.length} source packs` + ); + + await scanForBundleSize( + messages, + basePacks, + sourcePacks, + packSizeThreshold ); } catch (err) { - core.setFailed(`Failed to parse current lockfile: ${err}`); - return; + core.info(`Failed to compare pack sizes: ${err}`); } - try { - parsedBaseLock = await parseLockfile( - basePackageLock, - lockfileFilename, - basePackageJson ?? undefined - ); - core.info( - `Parsed base lockfile with ${parsedBaseLock.packages.length} packages` + } + + if (detectReplacements) { + if (!basePackageJson || !currentPackageJson) { + core.setFailed( + 'detect-replacements requires both base and current package.json to be present' ); - } catch (err) { - core.setFailed(`Failed to parse base lockfile: ${err}`); return; } - const currentDeps = computeDependencyVersions(parsedCurrentLock); - const baseDeps = computeDependencyVersions(parsedBaseLock); + const baseDependencies = getDependenciesFromPackageJson(basePackageJson, [ + 'optional', + 'peer', + 'dev', + 'prod' + ]); + const currentDependencies = getDependenciesFromPackageJson( + currentPackageJson, + ['optional', 'peer', 'dev', 'prod'] + ); - core.info(`Dependency threshold set to ${dependencyThreshold}`); - core.info(`Size threshold set to ${formatBytes(sizeThreshold)}`); - core.info(`Duplicate threshold set to ${duplicateThreshold}`); - core.info(`Pack size threshold set to ${formatBytes(packSizeThreshold)}`); + scanForReplacements(messages, baseDependencies, currentDependencies); + } - const messages: string[] = []; + const commentBody = + messages.length === 0 + ? `${COMMENT_TAG}\n## e18e dependency analysis\n\nNo dependency warnings found.\n` + : `${COMMENT_TAG}\n${messages.join('\n\n')}`; - scanForDependencyCount( - messages, - dependencyThreshold, - currentDeps, - baseDeps - ); - scanForDuplicates( - messages, - duplicateThreshold, - currentDeps, - lockfilePath, - parsedCurrentLock - ); + if (mode === 'artifact') { + const tmpDir = join(baseWorkspace, '.e18e-tmp'); + const outputPath = join(tmpDir, ARTIFACT_FILENAME); - await scanForDependencySize( - messages, - sizeThreshold, - currentDeps, - baseDeps, - parsedCurrentLock, - parsedBaseLock + await fs.mkdir(tmpDir, {recursive: true}); + await fs.writeFile( + outputPath, + JSON.stringify({pr_number: prNumber, body: commentBody}) ); - await scanForProvenance(messages, currentDeps, baseDeps); - - const basePackagesPattern = core.getInput('base-packages'); - const sourcePackagesPattern = core.getInput('source-packages'); - - if (basePackagesPattern && sourcePackagesPattern) { - try { - core.info( - `Comparing pack sizes between patterns: ${basePackagesPattern} and ${sourcePackagesPattern}` - ); - - const basePacks = await getPacksFromPattern(basePackagesPattern); - const sourcePacks = await getPacksFromPattern(sourcePackagesPattern); - - core.info( - `Found ${basePacks.length} base packs and ${sourcePacks.length} source packs` - ); - - await scanForBundleSize( - messages, - basePacks, - sourcePacks, - packSizeThreshold - ); - } catch (err) { - core.info(`Failed to compare pack sizes: ${err}`); - } - } - if (detectReplacements) { - if (!basePackageJson || !currentPackageJson) { - core.setFailed( - 'detect-replacements requires both base and current package.json to be present' - ); - return; - } - - const baseDependencies = getDependenciesFromPackageJson(basePackageJson, [ - 'optional', - 'peer', - 'dev', - 'prod' - ]); - const currentDependencies = getDependenciesFromPackageJson( - currentPackageJson, - ['optional', 'peer', 'dev', 'prod'] - ); + core.setOutput('artifact-path', outputPath); + core.info(`Wrote artifact to ${outputPath}`); + return; + } - scanForReplacements(messages, baseDependencies, currentDependencies); - } + const octokit = github.getOctokit(token); - const octokit = github.getOctokit(token); - let existingCommentId: number | undefined = undefined; - - const perPage = 100; - for await (const {data: comments} of octokit.paginate.iterator( - octokit.rest.issues.listComments, - { - owner: github.context.repo.owner, - repo: github.context.repo.repo, - issue_number: prNumber, - per_page: perPage - } - )) { - // Search for the comment with the unique tag - const comment = comments.find( - (c) => - c.user && - c.user.login === 'github-actions[bot]' && - c.body?.includes(COMMENT_TAG) - ); - if (comment) { - existingCommentId = comment.id; - break; - } + if (messages.length === 0) { + const existingCommentId = await findExistingComment(octokit, prNumber); + if (existingCommentId) { + await upsertComment(octokit, prNumber, commentBody); + } else { + core.info('No dependency warnings found. Skipping comment creation.'); } + return; + } - // Skip comment creation if there are no messages or update the existing comment. - if (messages.length === 0) { - if (existingCommentId) { - await octokit.rest.issues.updateComment({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - comment_id: existingCommentId, - body: `${COMMENT_TAG}\n## e18e dependency analysis\n\nNo dependency warnings found.\n` - }); - core.info( - `Updated existing dependency diff comment #${existingCommentId}` - ); - } else { - core.info('No dependency warnings found. Skipping comment creation.'); - } - return; - } + await upsertComment(octokit, prNumber, commentBody); +} - const finalCommentBody = `${COMMENT_TAG}\n${messages.join('\n\n')}`; +async function run(): Promise { + try { + const mode = core.getInput('mode') || 'comment'; - if (existingCommentId) { - await octokit.rest.issues.updateComment({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - comment_id: existingCommentId, - body: finalCommentBody - }); - core.info( - `Updated existing dependency diff comment #${existingCommentId}` - ); - } else { - await octokit.rest.issues.createComment({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - issue_number: prNumber, - body: finalCommentBody - }); - core.info('Created new dependency diff comment'); + if (mode === 'comment-from-artifact') { + await postCommentFromArtifact(); + return; } + + await analyzeAndComment(); } catch (error) { if (error instanceof Error) { core.setFailed(error.message);