From 07a016689a45c2c7215aaa94ae9535c216a020a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Fri, 7 Oct 2022 10:08:44 +0200 Subject: [PATCH 1/9] Create GitHub Summary from NI report outputs. --- action.yml | 8 + dist/cleanup/index.js | 4247 ++++++++++++++++++++++++++--- dist/main/index.js | 338 ++- src/cleanup.ts | 16 +- src/constants.ts | 4 + src/definitions/buildOutputDef.ts | 41 + src/definitions/dashboardNIDef.ts | 15 + src/features.ts | 10 +- src/gu.ts | 21 +- src/main.ts | 35 +- src/options.ts | 15 + src/reports.ts | 123 + src/utils.ts | 44 +- 13 files changed, 4528 insertions(+), 389 deletions(-) create mode 100644 src/definitions/buildOutputDef.ts create mode 100644 src/definitions/dashboardNIDef.ts create mode 100644 src/options.ts create mode 100644 src/reports.ts diff --git a/action.yml b/action.yml index 8c2cac2..018f4c7 100644 --- a/action.yml +++ b/action.yml @@ -33,6 +33,14 @@ inputs: required: false description: 'Set up musl for static image building with GraalVM Native Image.' default: 'false' + native-image-report-build: + required: false + description: 'Generate report of Native-Image build.' + default: 'false' + native-image-report-artifact: + required: false + description: 'Generate report of Native-Image artifact.' + default: 'false' runs: using: 'node16' main: 'dist/main/index.js' diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 93365e3..e92a36d 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -7005,6 +7005,616 @@ class SearchState { exports.SearchState = SearchState; //# sourceMappingURL=internal-search-state.js.map +/***/ }), + +/***/ 9925: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const http = __nccwpck_require__(3685); +const https = __nccwpck_require__(5687); +const pm = __nccwpck_require__(6443); +let tunnel; +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + let proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return new Promise(async (resolve, reject) => { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + let parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return this.request(verb, requestUrl, stream, additionalHeaders); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + async getJson(requestUrl, additionalHeaders = {}) { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + let res = await this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async postJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async putJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + async patchJson(requestUrl, obj, additionalHeaders = {}) { + let data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + let res = await this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + async request(verb, requestUrl, data, headers) { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + let parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + response = await this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + let parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol == 'https:' && + parsedUrl.protocol != parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + await response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (let header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = await this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + await response.readBody(); + await this._performExponentialBackoff(numTries); + } + } + return response; + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return new Promise((resolve, reject) => { + let callbackForResult = function (err, res) { + if (err) { + reject(err); + } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof data === 'string') { + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); + } + handleResult(new Error('Request timeout: ' + info.options.path), null); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err, null); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + let parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + this.handlers.forEach(handler => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _mergeHeaders(headers) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + let proxyUrl = pm.getProxyUrl(parsedUrl); + let useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (!!agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (!!this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + if (useProxy) { + // If using proxy, need tunnel + if (!tunnel) { + tunnel = __nccwpck_require__(4294); + } + const agentOptions = { + maxSockets: maxSockets, + keepAlive: this._keepAlive, + proxy: { + ...((proxyUrl.username || proxyUrl.password) && { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` + }), + host: proxyUrl.hostname, + port: proxyUrl.port + } + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + } + static dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + async _processResponse(res, options) { + return new Promise(async (resolve, reject) => { + const statusCode = res.message.statusCode; + const response = { + statusCode: statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode == HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + // get the result from the body + try { + contents = await res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, HttpClient.dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = 'Failed request: (' + statusCode + ')'; + } + let err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + }); + } +} +exports.HttpClient = HttpClient; + + +/***/ }), + +/***/ 6443: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function getProxyUrl(reqUrl) { + let usingSsl = reqUrl.protocol === 'https:'; + let proxyUrl; + if (checkBypass(reqUrl)) { + return proxyUrl; + } + let proxyVar; + if (usingSsl) { + proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + if (proxyVar) { + proxyUrl = new URL(proxyVar); + } + return proxyUrl; +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + let upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (let upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; + + /***/ }), /***/ 1962: @@ -7539,51 +8149,1032 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 2557: -/***/ ((__unused_webpack_module, exports) => { +/***/ 2473: +/***/ (function(module, exports, __nccwpck_require__) { "use strict"; - +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", ({ value: true })); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/// -const listenersMap = new WeakMap(); -const abortedMap = new WeakMap(); -/** - * An aborter instance implements AbortSignal interface, can abort HTTP requests. - * - * - Call AbortSignal.none to create a new AbortSignal instance that cannot be cancelled. - * Use `AbortSignal.none` when you are required to pass a cancellation token but the operation - * cannot or will not ever be cancelled. - * - * @example - * Abort without timeout - * ```ts - * await doAsyncWork(AbortSignal.none); - * ``` - */ -class AbortSignal { - constructor() { - /** - * onabort event listener. - */ - this.onabort = null; - listenersMap.set(this, []); - abortedMap.set(this, false); - } - /** - * Status of whether aborted or not. - * - * @readonly - */ - get aborted() { - if (!abortedMap.has(this)) { - throw new TypeError("Expected `this` to be an instance of AbortSignal."); +exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0; +const semver = __importStar(__nccwpck_require__(5911)); +const core_1 = __nccwpck_require__(2186); +// needs to be require for core node modules to be mocked +/* eslint @typescript-eslint/no-require-imports: 0 */ +const os = __nccwpck_require__(2037); +const cp = __nccwpck_require__(2081); +const fs = __nccwpck_require__(7147); +function _findMatch(versionSpec, stable, candidates, archFilter) { + return __awaiter(this, void 0, void 0, function* () { + const platFilter = os.platform(); + let result; + let match; + let file; + for (const candidate of candidates) { + const version = candidate.version; + core_1.debug(`check ${version} satisfies ${versionSpec}`); + if (semver.satisfies(version, versionSpec) && + (!stable || candidate.stable === stable)) { + file = candidate.files.find(item => { + core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`); + let chk = item.arch === archFilter && item.platform === platFilter; + if (chk && item.platform_version) { + const osVersion = module.exports._getOsVersion(); + if (osVersion === item.platform_version) { + chk = true; + } + else { + chk = semver.satisfies(osVersion, item.platform_version); + } + } + return chk; + }); + if (file) { + core_1.debug(`matched ${candidate.version}`); + match = candidate; + break; + } + } + } + if (match && file) { + // clone since we're mutating the file list to be only the file that matches + result = Object.assign({}, match); + result.files = [file]; + } + return result; + }); +} +exports._findMatch = _findMatch; +function _getOsVersion() { + // TODO: add windows and other linux, arm variants + // right now filtering on version is only an ubuntu and macos scenario for tools we build for hosted (python) + const plat = os.platform(); + let version = ''; + if (plat === 'darwin') { + version = cp.execSync('sw_vers -productVersion').toString(); + } + else if (plat === 'linux') { + // lsb_release process not in some containers, readfile + // Run cat /etc/lsb-release + // DISTRIB_ID=Ubuntu + // DISTRIB_RELEASE=18.04 + // DISTRIB_CODENAME=bionic + // DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" + const lsbContents = module.exports._readLinuxVersionFile(); + if (lsbContents) { + const lines = lsbContents.split('\n'); + for (const line of lines) { + const parts = line.split('='); + if (parts.length === 2 && + (parts[0].trim() === 'VERSION_ID' || + parts[0].trim() === 'DISTRIB_RELEASE')) { + version = parts[1] + .trim() + .replace(/^"/, '') + .replace(/"$/, ''); + break; + } + } } - return abortedMap.get(this); + } + return version; +} +exports._getOsVersion = _getOsVersion; +function _readLinuxVersionFile() { + const lsbReleaseFile = '/etc/lsb-release'; + const osReleaseFile = '/etc/os-release'; + let contents = ''; + if (fs.existsSync(lsbReleaseFile)) { + contents = fs.readFileSync(lsbReleaseFile).toString(); + } + else if (fs.existsSync(osReleaseFile)) { + contents = fs.readFileSync(osReleaseFile).toString(); + } + return contents; +} +exports._readLinuxVersionFile = _readLinuxVersionFile; +//# sourceMappingURL=manifest.js.map + +/***/ }), + +/***/ 8279: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RetryHelper = void 0; +const core = __importStar(__nccwpck_require__(2186)); +/** + * Internal class for retries + */ +class RetryHelper { + constructor(maxAttempts, minSeconds, maxSeconds) { + if (maxAttempts < 1) { + throw new Error('max attempts should be greater than or equal to 1'); + } + this.maxAttempts = maxAttempts; + this.minSeconds = Math.floor(minSeconds); + this.maxSeconds = Math.floor(maxSeconds); + if (this.minSeconds > this.maxSeconds) { + throw new Error('min seconds should be less than or equal to max seconds'); + } + } + execute(action, isRetryable) { + return __awaiter(this, void 0, void 0, function* () { + let attempt = 1; + while (attempt < this.maxAttempts) { + // Try + try { + return yield action(); + } + catch (err) { + if (isRetryable && !isRetryable(err)) { + throw err; + } + core.info(err.message); + } + // Sleep + const seconds = this.getSleepAmount(); + core.info(`Waiting ${seconds} seconds before trying again`); + yield this.sleep(seconds); + attempt++; + } + // Last attempt + return yield action(); + }); + } + getSleepAmount() { + return (Math.floor(Math.random() * (this.maxSeconds - this.minSeconds + 1)) + + this.minSeconds); + } + sleep(seconds) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(resolve => setTimeout(resolve, seconds * 1000)); + }); + } +} +exports.RetryHelper = RetryHelper; +//# sourceMappingURL=retry-helper.js.map + +/***/ }), + +/***/ 7784: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const io = __importStar(__nccwpck_require__(7436)); +const fs = __importStar(__nccwpck_require__(7147)); +const mm = __importStar(__nccwpck_require__(2473)); +const os = __importStar(__nccwpck_require__(2037)); +const path = __importStar(__nccwpck_require__(1017)); +const httpm = __importStar(__nccwpck_require__(9925)); +const semver = __importStar(__nccwpck_require__(5911)); +const stream = __importStar(__nccwpck_require__(2781)); +const util = __importStar(__nccwpck_require__(3837)); +const v4_1 = __importDefault(__nccwpck_require__(7468)); +const exec_1 = __nccwpck_require__(1514); +const assert_1 = __nccwpck_require__(9491); +const retry_helper_1 = __nccwpck_require__(8279); +class HTTPError extends Error { + constructor(httpStatusCode) { + super(`Unexpected HTTP response: ${httpStatusCode}`); + this.httpStatusCode = httpStatusCode; + Object.setPrototypeOf(this, new.target.prototype); + } +} +exports.HTTPError = HTTPError; +const IS_WINDOWS = process.platform === 'win32'; +const IS_MAC = process.platform === 'darwin'; +const userAgent = 'actions/tool-cache'; +/** + * Download a tool from an url and stream it into a file + * + * @param url url of tool to download + * @param dest path to download tool + * @param auth authorization header + * @param headers other headers + * @returns path to downloaded tool + */ +function downloadTool(url, dest, auth, headers) { + return __awaiter(this, void 0, void 0, function* () { + dest = dest || path.join(_getTempDirectory(), v4_1.default()); + yield io.mkdirP(path.dirname(dest)); + core.debug(`Downloading ${url}`); + core.debug(`Destination ${dest}`); + const maxAttempts = 3; + const minSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 10); + const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20); + const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds); + return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () { + return yield downloadToolAttempt(url, dest || '', auth, headers); + }), (err) => { + if (err instanceof HTTPError && err.httpStatusCode) { + // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests + if (err.httpStatusCode < 500 && + err.httpStatusCode !== 408 && + err.httpStatusCode !== 429) { + return false; + } + } + // Otherwise retry + return true; + }); + }); +} +exports.downloadTool = downloadTool; +function downloadToolAttempt(url, dest, auth, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (fs.existsSync(dest)) { + throw new Error(`Destination file path ${dest} already exists`); + } + // Get the response headers + const http = new httpm.HttpClient(userAgent, [], { + allowRetries: false + }); + if (auth) { + core.debug('set auth'); + if (headers === undefined) { + headers = {}; + } + headers.authorization = auth; + } + const response = yield http.get(url, headers); + if (response.message.statusCode !== 200) { + const err = new HTTPError(response.message.statusCode); + core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); + throw err; + } + // Download the response body + const pipeline = util.promisify(stream.pipeline); + const responseMessageFactory = _getGlobal('TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY', () => response.message); + const readStream = responseMessageFactory(); + let succeeded = false; + try { + yield pipeline(readStream, fs.createWriteStream(dest)); + core.debug('download complete'); + succeeded = true; + return dest; + } + finally { + // Error, delete dest before retry + if (!succeeded) { + core.debug('download failed'); + try { + yield io.rmRF(dest); + } + catch (err) { + core.debug(`Failed to delete '${dest}'. ${err.message}`); + } + } + } + }); +} +/** + * Extract a .7z file + * + * @param file path to the .7z file + * @param dest destination directory. Optional. + * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this + * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will + * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is + * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line + * interface, it is smaller than the full command line interface, and it does support long paths. At the + * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website. + * Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path + * to 7zr.exe can be pass to this function. + * @returns path to the destination directory + */ +function extract7z(file, dest, _7zPath) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS'); + assert_1.ok(file, 'parameter "file" is required'); + dest = yield _createExtractFolder(dest); + const originalCwd = process.cwd(); + process.chdir(dest); + if (_7zPath) { + try { + const logLevel = core.isDebug() ? '-bb1' : '-bb0'; + const args = [ + 'x', + logLevel, + '-bd', + '-sccUTF-8', + file + ]; + const options = { + silent: true + }; + yield exec_1.exec(`"${_7zPath}"`, args, options); + } + finally { + process.chdir(originalCwd); + } + } + else { + const escapedScript = path + .join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1') + .replace(/'/g, "''") + .replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines + const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`; + const args = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command', + command + ]; + const options = { + silent: true + }; + try { + const powershellPath = yield io.which('powershell', true); + yield exec_1.exec(`"${powershellPath}"`, args, options); + } + finally { + process.chdir(originalCwd); + } + } + return dest; + }); +} +exports.extract7z = extract7z; +/** + * Extract a compressed tar archive + * + * @param file path to the tar + * @param dest destination directory. Optional. + * @param flags flags for the tar command to use for extraction. Defaults to 'xz' (extracting gzipped tars). Optional. + * @returns path to the destination directory + */ +function extractTar(file, dest, flags = 'xz') { + return __awaiter(this, void 0, void 0, function* () { + if (!file) { + throw new Error("parameter 'file' is required"); + } + // Create dest + dest = yield _createExtractFolder(dest); + // Determine whether GNU tar + core.debug('Checking tar --version'); + let versionOutput = ''; + yield exec_1.exec('tar --version', [], { + ignoreReturnCode: true, + silent: true, + listeners: { + stdout: (data) => (versionOutput += data.toString()), + stderr: (data) => (versionOutput += data.toString()) + } + }); + core.debug(versionOutput.trim()); + const isGnuTar = versionOutput.toUpperCase().includes('GNU TAR'); + // Initialize args + let args; + if (flags instanceof Array) { + args = flags; + } + else { + args = [flags]; + } + if (core.isDebug() && !flags.includes('v')) { + args.push('-v'); + } + let destArg = dest; + let fileArg = file; + if (IS_WINDOWS && isGnuTar) { + args.push('--force-local'); + destArg = dest.replace(/\\/g, '/'); + // Technically only the dest needs to have `/` but for aesthetic consistency + // convert slashes in the file arg too. + fileArg = file.replace(/\\/g, '/'); + } + if (isGnuTar) { + // Suppress warnings when using GNU tar to extract archives created by BSD tar + args.push('--warning=no-unknown-keyword'); + args.push('--overwrite'); + } + args.push('-C', destArg, '-f', fileArg); + yield exec_1.exec(`tar`, args); + return dest; + }); +} +exports.extractTar = extractTar; +/** + * Extract a xar compatible archive + * + * @param file path to the archive + * @param dest destination directory. Optional. + * @param flags flags for the xar. Optional. + * @returns path to the destination directory + */ +function extractXar(file, dest, flags = []) { + return __awaiter(this, void 0, void 0, function* () { + assert_1.ok(IS_MAC, 'extractXar() not supported on current OS'); + assert_1.ok(file, 'parameter "file" is required'); + dest = yield _createExtractFolder(dest); + let args; + if (flags instanceof Array) { + args = flags; + } + else { + args = [flags]; + } + args.push('-x', '-C', dest, '-f', file); + if (core.isDebug()) { + args.push('-v'); + } + const xarPath = yield io.which('xar', true); + yield exec_1.exec(`"${xarPath}"`, _unique(args)); + return dest; + }); +} +exports.extractXar = extractXar; +/** + * Extract a zip + * + * @param file path to the zip + * @param dest destination directory. Optional. + * @returns path to the destination directory + */ +function extractZip(file, dest) { + return __awaiter(this, void 0, void 0, function* () { + if (!file) { + throw new Error("parameter 'file' is required"); + } + dest = yield _createExtractFolder(dest); + if (IS_WINDOWS) { + yield extractZipWin(file, dest); + } + else { + yield extractZipNix(file, dest); + } + return dest; + }); +} +exports.extractZip = extractZip; +function extractZipWin(file, dest) { + return __awaiter(this, void 0, void 0, function* () { + // build the powershell command + const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines + const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + const pwshPath = yield io.which('pwsh', false); + //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory + //and the -Force flag for Expand-Archive as a fallback + if (pwshPath) { + //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive + const pwshCommand = [ + `$ErrorActionPreference = 'Stop' ;`, + `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`, + `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`, + `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;` + ].join(' '); + const args = [ + '-NoLogo', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command', + pwshCommand + ]; + core.debug(`Using pwsh at path: ${pwshPath}`); + yield exec_1.exec(`"${pwshPath}"`, args); + } + else { + const powershellCommand = [ + `$ErrorActionPreference = 'Stop' ;`, + `try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`, + `if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`, + `else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }` + ].join(' '); + const args = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command', + powershellCommand + ]; + const powershellPath = yield io.which('powershell', true); + core.debug(`Using powershell at path: ${powershellPath}`); + yield exec_1.exec(`"${powershellPath}"`, args); + } + }); +} +function extractZipNix(file, dest) { + return __awaiter(this, void 0, void 0, function* () { + const unzipPath = yield io.which('unzip', true); + const args = [file]; + if (!core.isDebug()) { + args.unshift('-q'); + } + args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run + yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest }); + }); +} +/** + * Caches a directory and installs it into the tool cacheDir + * + * @param sourceDir the directory to cache into tools + * @param tool tool name + * @param version version of the tool. semver format + * @param arch architecture of the tool. Optional. Defaults to machine architecture + */ +function cacheDir(sourceDir, tool, version, arch) { + return __awaiter(this, void 0, void 0, function* () { + version = semver.clean(version) || version; + arch = arch || os.arch(); + core.debug(`Caching tool ${tool} ${version} ${arch}`); + core.debug(`source dir: ${sourceDir}`); + if (!fs.statSync(sourceDir).isDirectory()) { + throw new Error('sourceDir is not a directory'); + } + // Create the tool dir + const destPath = yield _createToolPath(tool, version, arch); + // copy each child item. do not move. move can fail on Windows + // due to anti-virus software having an open handle on a file. + for (const itemName of fs.readdirSync(sourceDir)) { + const s = path.join(sourceDir, itemName); + yield io.cp(s, destPath, { recursive: true }); + } + // write .complete + _completeToolPath(tool, version, arch); + return destPath; + }); +} +exports.cacheDir = cacheDir; +/** + * Caches a downloaded file (GUID) and installs it + * into the tool cache with a given targetName + * + * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid. + * @param targetFile the name of the file name in the tools directory + * @param tool tool name + * @param version version of the tool. semver format + * @param arch architecture of the tool. Optional. Defaults to machine architecture + */ +function cacheFile(sourceFile, targetFile, tool, version, arch) { + return __awaiter(this, void 0, void 0, function* () { + version = semver.clean(version) || version; + arch = arch || os.arch(); + core.debug(`Caching tool ${tool} ${version} ${arch}`); + core.debug(`source file: ${sourceFile}`); + if (!fs.statSync(sourceFile).isFile()) { + throw new Error('sourceFile is not a file'); + } + // create the tool dir + const destFolder = yield _createToolPath(tool, version, arch); + // copy instead of move. move can fail on Windows due to + // anti-virus software having an open handle on a file. + const destPath = path.join(destFolder, targetFile); + core.debug(`destination file ${destPath}`); + yield io.cp(sourceFile, destPath); + // write .complete + _completeToolPath(tool, version, arch); + return destFolder; + }); +} +exports.cacheFile = cacheFile; +/** + * Finds the path to a tool version in the local installed tool cache + * + * @param toolName name of the tool + * @param versionSpec version of the tool + * @param arch optional arch. defaults to arch of computer + */ +function find(toolName, versionSpec, arch) { + if (!toolName) { + throw new Error('toolName parameter is required'); + } + if (!versionSpec) { + throw new Error('versionSpec parameter is required'); + } + arch = arch || os.arch(); + // attempt to resolve an explicit version + if (!isExplicitVersion(versionSpec)) { + const localVersions = findAllVersions(toolName, arch); + const match = evaluateVersions(localVersions, versionSpec); + versionSpec = match; + } + // check for the explicit version in the cache + let toolPath = ''; + if (versionSpec) { + versionSpec = semver.clean(versionSpec) || ''; + const cachePath = path.join(_getCacheDirectory(), toolName, versionSpec, arch); + core.debug(`checking cache: ${cachePath}`); + if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) { + core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`); + toolPath = cachePath; + } + else { + core.debug('not found'); + } + } + return toolPath; +} +exports.find = find; +/** + * Finds the paths to all versions of a tool that are installed in the local tool cache + * + * @param toolName name of the tool + * @param arch optional arch. defaults to arch of computer + */ +function findAllVersions(toolName, arch) { + const versions = []; + arch = arch || os.arch(); + const toolPath = path.join(_getCacheDirectory(), toolName); + if (fs.existsSync(toolPath)) { + const children = fs.readdirSync(toolPath); + for (const child of children) { + if (isExplicitVersion(child)) { + const fullPath = path.join(toolPath, child, arch || ''); + if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) { + versions.push(child); + } + } + } + } + return versions; +} +exports.findAllVersions = findAllVersions; +function getManifestFromRepo(owner, repo, auth, branch = 'master') { + return __awaiter(this, void 0, void 0, function* () { + let releases = []; + const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`; + const http = new httpm.HttpClient('tool-cache'); + const headers = {}; + if (auth) { + core.debug('set auth'); + headers.authorization = auth; + } + const response = yield http.getJson(treeUrl, headers); + if (!response.result) { + return releases; + } + let manifestUrl = ''; + for (const item of response.result.tree) { + if (item.path === 'versions-manifest.json') { + manifestUrl = item.url; + break; + } + } + headers['accept'] = 'application/vnd.github.VERSION.raw'; + let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody(); + if (versionsRaw) { + // shouldn't be needed but protects against invalid json saved with BOM + versionsRaw = versionsRaw.replace(/^\uFEFF/, ''); + try { + releases = JSON.parse(versionsRaw); + } + catch (_a) { + core.debug('Invalid json'); + } + } + return releases; + }); +} +exports.getManifestFromRepo = getManifestFromRepo; +function findFromManifest(versionSpec, stable, manifest, archFilter = os.arch()) { + return __awaiter(this, void 0, void 0, function* () { + // wrap the internal impl + const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter); + return match; + }); +} +exports.findFromManifest = findFromManifest; +function _createExtractFolder(dest) { + return __awaiter(this, void 0, void 0, function* () { + if (!dest) { + // create a temp dir + dest = path.join(_getTempDirectory(), v4_1.default()); + } + yield io.mkdirP(dest); + return dest; + }); +} +function _createToolPath(tool, version, arch) { + return __awaiter(this, void 0, void 0, function* () { + const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || ''); + core.debug(`destination ${folderPath}`); + const markerPath = `${folderPath}.complete`; + yield io.rmRF(folderPath); + yield io.rmRF(markerPath); + yield io.mkdirP(folderPath); + return folderPath; + }); +} +function _completeToolPath(tool, version, arch) { + const folderPath = path.join(_getCacheDirectory(), tool, semver.clean(version) || version, arch || ''); + const markerPath = `${folderPath}.complete`; + fs.writeFileSync(markerPath, ''); + core.debug('finished caching tool'); +} +/** + * Check if version string is explicit + * + * @param versionSpec version string to check + */ +function isExplicitVersion(versionSpec) { + const c = semver.clean(versionSpec) || ''; + core.debug(`isExplicit: ${c}`); + const valid = semver.valid(c) != null; + core.debug(`explicit? ${valid}`); + return valid; +} +exports.isExplicitVersion = isExplicitVersion; +/** + * Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec` + * + * @param versions array of versions to evaluate + * @param versionSpec semantic version spec to satisfy + */ +function evaluateVersions(versions, versionSpec) { + let version = ''; + core.debug(`evaluating ${versions.length} versions`); + versions = versions.sort((a, b) => { + if (semver.gt(a, b)) { + return 1; + } + return -1; + }); + for (let i = versions.length - 1; i >= 0; i--) { + const potential = versions[i]; + const satisfied = semver.satisfies(potential, versionSpec); + if (satisfied) { + version = potential; + break; + } + } + if (version) { + core.debug(`matched: ${version}`); + } + else { + core.debug('match not found'); + } + return version; +} +exports.evaluateVersions = evaluateVersions; +/** + * Gets RUNNER_TOOL_CACHE + */ +function _getCacheDirectory() { + const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || ''; + assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined'); + return cacheDirectory; +} +/** + * Gets RUNNER_TEMP + */ +function _getTempDirectory() { + const tempDirectory = process.env['RUNNER_TEMP'] || ''; + assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined'); + return tempDirectory; +} +/** + * Gets a global variable + */ +function _getGlobal(key, defaultValue) { + /* eslint-disable @typescript-eslint/no-explicit-any */ + const value = global[key]; + /* eslint-enable @typescript-eslint/no-explicit-any */ + return value !== undefined ? value : defaultValue; +} +/** + * Returns an array of unique values. + * @param values Values to make unique. + */ +function _unique(values) { + return Array.from(new Set(values)); +} +//# sourceMappingURL=tool-cache.js.map + +/***/ }), + +/***/ 7701: +/***/ ((module) => { + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +var byteToHex = []; +for (var i = 0; i < 256; ++i) { + byteToHex[i] = (i + 0x100).toString(16).substr(1); +} + +function bytesToUuid(buf, offset) { + var i = offset || 0; + var bth = byteToHex; + // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + return ([ + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]] + ]).join(''); +} + +module.exports = bytesToUuid; + + +/***/ }), + +/***/ 7269: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +// Unique ID creation requires a high quality random # generator. In node.js +// this is pretty straight-forward - we use the crypto API. + +var crypto = __nccwpck_require__(6113); + +module.exports = function nodeRNG() { + return crypto.randomBytes(16); +}; + + +/***/ }), + +/***/ 7468: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var rng = __nccwpck_require__(7269); +var bytesToUuid = __nccwpck_require__(7701); + +function v4(options, buf, offset) { + var i = buf && offset || 0; + + if (typeof(options) == 'string') { + buf = options === 'binary' ? new Array(16) : null; + options = null; + } + options = options || {}; + + var rnds = options.random || (options.rng || rng)(); + + // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + rnds[6] = (rnds[6] & 0x0f) | 0x40; + rnds[8] = (rnds[8] & 0x3f) | 0x80; + + // Copy bytes to buffer, if provided + if (buf) { + for (var ii = 0; ii < 16; ++ii) { + buf[i + ii] = rnds[ii]; + } + } + + return buf || bytesToUuid(rnds); +} + +module.exports = v4; + + +/***/ }), + +/***/ 2557: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +/// +const listenersMap = new WeakMap(); +const abortedMap = new WeakMap(); +/** + * An aborter instance implements AbortSignal interface, can abort HTTP requests. + * + * - Call AbortSignal.none to create a new AbortSignal instance that cannot be cancelled. + * Use `AbortSignal.none` when you are required to pass a cancellation token but the operation + * cannot or will not ever be cancelled. + * + * @example + * Abort without timeout + * ```ts + * await doAsyncWork(AbortSignal.none); + * ``` + */ +class AbortSignal { + constructor() { + /** + * onabort event listener. + */ + this.onabort = null; + listenersMap.set(this, []); + abortedMap.set(this, false); + } + /** + * Status of whether aborted or not. + * + * @readonly + */ + get aborted() { + if (!abortedMap.has(this)) { + throw new TypeError("Expected `this` to be an instance of AbortSignal."); + } + return abortedMap.get(this); } /** * Creates a new AbortSignal instance that will never be aborted. @@ -43898,328 +45489,1366 @@ exports.newPipeline = newPipeline; //# sourceMappingURL=index.js.map -/***/ }), +/***/ }), + +/***/ 679: +/***/ ((module) => { + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __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()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) 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 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); +}); + + +/***/ }), + +/***/ 334: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const REGEX_IS_INSTALLATION_LEGACY = /^v1\./; +const REGEX_IS_INSTALLATION = /^ghs_/; +const REGEX_IS_USER_TO_SERVER = /^ghu_/; +async function auth(token) { + const isApp = token.split(/\./).length === 3; + const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token); + const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token); + const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth"; + return { + type: "token", + token: token, + tokenType + }; +} + +/** + * Prefix token for usage in the Authorization header + * + * @param token OAuth token or JSON Web Token + */ +function withAuthorizationPrefix(token) { + if (token.split(/\./).length === 3) { + return `bearer ${token}`; + } + + return `token ${token}`; +} + +async function hook(token, request, route, parameters) { + const endpoint = request.endpoint.merge(route, parameters); + endpoint.headers.authorization = withAuthorizationPrefix(token); + return request(endpoint); +} + +const createTokenAuth = function createTokenAuth(token) { + if (!token) { + throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); + } + + if (typeof token !== "string") { + throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string"); + } + + token = token.replace(/^(token|bearer) +/i, ""); + return Object.assign(auth.bind(null, token), { + hook: hook.bind(null, token) + }); +}; + +exports.createTokenAuth = createTokenAuth; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 6762: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var universalUserAgent = __nccwpck_require__(5030); +var beforeAfterHook = __nccwpck_require__(3682); +var request = __nccwpck_require__(6234); +var graphql = __nccwpck_require__(8467); +var authToken = __nccwpck_require__(334); + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + + var target = _objectWithoutPropertiesLoose(source, excluded); + + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +const VERSION = "3.6.0"; + +const _excluded = ["authStrategy"]; +class Octokit { + constructor(options = {}) { + const hook = new beforeAfterHook.Collection(); + const requestDefaults = { + baseUrl: request.request.endpoint.DEFAULTS.baseUrl, + headers: {}, + request: Object.assign({}, options.request, { + // @ts-ignore internal usage only, no need to type + hook: hook.bind(null, "request") + }), + mediaType: { + previews: [], + format: "" + } + }; // prepend default user agent with `options.userAgent` if set + + requestDefaults.headers["user-agent"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(" "); + + if (options.baseUrl) { + requestDefaults.baseUrl = options.baseUrl; + } + + if (options.previews) { + requestDefaults.mediaType.previews = options.previews; + } + + if (options.timeZone) { + requestDefaults.headers["time-zone"] = options.timeZone; + } + + this.request = request.request.defaults(requestDefaults); + this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults); + this.log = Object.assign({ + debug: () => {}, + info: () => {}, + warn: console.warn.bind(console), + error: console.error.bind(console) + }, options.log); + this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance + // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered. + // (2) If only `options.auth` is set, use the default token authentication strategy. + // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance. + // TODO: type `options.auth` based on `options.authStrategy`. + + if (!options.authStrategy) { + if (!options.auth) { + // (1) + this.auth = async () => ({ + type: "unauthenticated" + }); + } else { + // (2) + const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\_(ツ)_/¯ + + hook.wrap("request", auth.hook); + this.auth = auth; + } + } else { + const { + authStrategy + } = options, + otherOptions = _objectWithoutProperties(options, _excluded); + + const auth = authStrategy(Object.assign({ + request: this.request, + log: this.log, + // we pass the current octokit instance as well as its constructor options + // to allow for authentication strategies that return a new octokit instance + // that shares the same internal state as the current one. The original + // requirement for this was the "event-octokit" authentication strategy + // of https://github.com/probot/octokit-auth-probot. + octokit: this, + octokitOptions: otherOptions + }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ + + hook.wrap("request", auth.hook); + this.auth = auth; + } // apply plugins + // https://stackoverflow.com/a/16345172 + + + const classConstructor = this.constructor; + classConstructor.plugins.forEach(plugin => { + Object.assign(this, plugin(this, options)); + }); + } + + static defaults(defaults) { + const OctokitWithDefaults = class extends this { + constructor(...args) { + const options = args[0] || {}; + + if (typeof defaults === "function") { + super(defaults(options)); + return; + } + + super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? { + userAgent: `${options.userAgent} ${defaults.userAgent}` + } : null)); + } + + }; + return OctokitWithDefaults; + } + /** + * Attach a plugin (or many) to your Octokit instance. + * + * @example + * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...) + */ + + + static plugin(...newPlugins) { + var _a; + + const currentPlugins = this.plugins; + const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a); + return NewOctokit; + } + +} +Octokit.VERSION = VERSION; +Octokit.plugins = []; + +exports.Octokit = Octokit; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 9440: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var isPlainObject = __nccwpck_require__(3287); +var universalUserAgent = __nccwpck_require__(5030); + +function lowercaseKeys(object) { + if (!object) { + return {}; + } + + return Object.keys(object).reduce((newObj, key) => { + newObj[key.toLowerCase()] = object[key]; + return newObj; + }, {}); +} + +function mergeDeep(defaults, options) { + const result = Object.assign({}, defaults); + Object.keys(options).forEach(key => { + if (isPlainObject.isPlainObject(options[key])) { + if (!(key in defaults)) Object.assign(result, { + [key]: options[key] + });else result[key] = mergeDeep(defaults[key], options[key]); + } else { + Object.assign(result, { + [key]: options[key] + }); + } + }); + return result; +} + +function removeUndefinedProperties(obj) { + for (const key in obj) { + if (obj[key] === undefined) { + delete obj[key]; + } + } + + return obj; +} + +function merge(defaults, route, options) { + if (typeof route === "string") { + let [method, url] = route.split(" "); + options = Object.assign(url ? { + method, + url + } : { + url: method + }, options); + } else { + options = Object.assign({}, route); + } // lowercase header names before merging with defaults to avoid duplicates + + + options.headers = lowercaseKeys(options.headers); // remove properties with undefined values before merging + + removeUndefinedProperties(options); + removeUndefinedProperties(options.headers); + const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten + + if (defaults && defaults.mediaType.previews.length) { + mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews); + } + + mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, "")); + return mergedOptions; +} + +function addQueryParameters(url, parameters) { + const separator = /\?/.test(url) ? "&" : "?"; + const names = Object.keys(parameters); + + if (names.length === 0) { + return url; + } + + return url + separator + names.map(name => { + if (name === "q") { + return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+"); + } + + return `${name}=${encodeURIComponent(parameters[name])}`; + }).join("&"); +} + +const urlVariableRegex = /\{[^}]+\}/g; + +function removeNonChars(variableName) { + return variableName.replace(/^\W+|\W+$/g, "").split(/,/); +} + +function extractUrlVariableNames(url) { + const matches = url.match(urlVariableRegex); + + if (!matches) { + return []; + } + + return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []); +} + +function omit(object, keysToOmit) { + return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => { + obj[key] = object[key]; + return obj; + }, {}); +} + +// Based on https://github.com/bramstein/url-template, licensed under BSD +// TODO: create separate package. +// +// Copyright (c) 2012-2014, Bram Stein +// All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* istanbul ignore file */ +function encodeReserved(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]"); + } + + return part; + }).join(""); +} + +function encodeUnreserved(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} + +function encodeValue(operator, value, key) { + value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value); + + if (key) { + return encodeUnreserved(key) + "=" + value; + } else { + return value; + } +} + +function isDefined(value) { + return value !== undefined && value !== null; +} + +function isKeyOperator(operator) { + return operator === ";" || operator === "&" || operator === "?"; +} + +function getValues(context, operator, key, modifier) { + var value = context[key], + result = []; + + if (isDefined(value) && value !== "") { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + value = value.toString(); + + if (modifier && modifier !== "*") { + value = value.substring(0, parseInt(modifier, 10)); + } + + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); + } else { + if (modifier === "*") { + if (Array.isArray(value)) { + value.filter(isDefined).forEach(function (value) { + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : "")); + }); + } else { + Object.keys(value).forEach(function (k) { + if (isDefined(value[k])) { + result.push(encodeValue(operator, value[k], k)); + } + }); + } + } else { + const tmp = []; + + if (Array.isArray(value)) { + value.filter(isDefined).forEach(function (value) { + tmp.push(encodeValue(operator, value)); + }); + } else { + Object.keys(value).forEach(function (k) { + if (isDefined(value[k])) { + tmp.push(encodeUnreserved(k)); + tmp.push(encodeValue(operator, value[k].toString())); + } + }); + } + + if (isKeyOperator(operator)) { + result.push(encodeUnreserved(key) + "=" + tmp.join(",")); + } else if (tmp.length !== 0) { + result.push(tmp.join(",")); + } + } + } + } else { + if (operator === ";") { + if (isDefined(value)) { + result.push(encodeUnreserved(key)); + } + } else if (value === "" && (operator === "&" || operator === "?")) { + result.push(encodeUnreserved(key) + "="); + } else if (value === "") { + result.push(""); + } + } + + return result; +} + +function parseUrl(template) { + return { + expand: expand.bind(null, template) + }; +} + +function expand(template, context) { + var operators = ["+", "#", ".", "/", ";", "?", "&"]; + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) { + if (expression) { + let operator = ""; + const values = []; + + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + + expression.split(/,/g).forEach(function (variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3])); + }); + + if (operator && operator !== "+") { + var separator = ","; + + if (operator === "?") { + separator = "&"; + } else if (operator !== "#") { + separator = operator; + } + + return (values.length !== 0 ? operator : "") + values.join(separator); + } else { + return values.join(","); + } + } else { + return encodeReserved(literal); + } + }); +} + +function parse(options) { + // https://fetch.spec.whatwg.org/#methods + let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible + + let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}"); + let headers = Object.assign({}, options.headers); + let body; + let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later + + const urlVariableNames = extractUrlVariableNames(url); + url = parseUrl(url).expand(parameters); + + if (!/^http/.test(url)) { + url = options.baseUrl + url; + } + + const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl"); + const remainingParameters = omit(parameters, omittedParameters); + const isBinaryRequest = /application\/octet-stream/i.test(headers.accept); + + if (!isBinaryRequest) { + if (options.mediaType.format) { + // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw + headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(","); + } + + if (options.mediaType.previews.length) { + const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || []; + headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => { + const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; + return `application/vnd.github.${preview}-preview${format}`; + }).join(","); + } + } // for GET/HEAD requests, set URL query parameters from remaining parameters + // for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters + + + if (["GET", "HEAD"].includes(method)) { + url = addQueryParameters(url, remainingParameters); + } else { + if ("data" in remainingParameters) { + body = remainingParameters.data; + } else { + if (Object.keys(remainingParameters).length) { + body = remainingParameters; + } else { + headers["content-length"] = 0; + } + } + } // default content-type for JSON if body is set + + + if (!headers["content-type"] && typeof body !== "undefined") { + headers["content-type"] = "application/json; charset=utf-8"; + } // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body. + // fetch does not allow to set `content-length` header, but we can set body to an empty string + + + if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") { + body = ""; + } // Only return body/request keys if present + + + return Object.assign({ + method, + url, + headers + }, typeof body !== "undefined" ? { + body + } : null, options.request ? { + request: options.request + } : null); +} + +function endpointWithDefaults(defaults, route, options) { + return parse(merge(defaults, route, options)); +} + +function withDefaults(oldDefaults, newDefaults) { + const DEFAULTS = merge(oldDefaults, newDefaults); + const endpoint = endpointWithDefaults.bind(null, DEFAULTS); + return Object.assign(endpoint, { + DEFAULTS, + defaults: withDefaults.bind(null, DEFAULTS), + merge: merge.bind(null, DEFAULTS), + parse + }); +} + +const VERSION = "6.0.12"; + +const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. +// So we use RequestParameters and add method as additional required property. + +const DEFAULTS = { + method: "GET", + baseUrl: "https://api.github.com", + headers: { + accept: "application/vnd.github.v3+json", + "user-agent": userAgent + }, + mediaType: { + format: "", + previews: [] + } +}; + +const endpoint = withDefaults(null, DEFAULTS); + +exports.endpoint = endpoint; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 8467: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var request = __nccwpck_require__(6234); +var universalUserAgent = __nccwpck_require__(5030); + +const VERSION = "4.8.0"; + +function _buildMessageForResponseErrors(data) { + return `Request failed due to following response errors:\n` + data.errors.map(e => ` - ${e.message}`).join("\n"); +} + +class GraphqlResponseError extends Error { + constructor(request, headers, response) { + super(_buildMessageForResponseErrors(response)); + this.request = request; + this.headers = headers; + this.response = response; + this.name = "GraphqlResponseError"; // Expose the errors and response data in their shorthand properties. + + this.errors = response.errors; + this.data = response.data; // Maintains proper stack trace (only available on V8) + + /* istanbul ignore next */ + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + } + +} + +const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; +const FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; +const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; +function graphql(request, query, options) { + if (options) { + if (typeof query === "string" && "query" in options) { + return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`)); + } + + for (const key in options) { + if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue; + return Promise.reject(new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)); + } + } + + const parsedOptions = typeof query === "string" ? Object.assign({ + query + }, options) : query; + const requestOptions = Object.keys(parsedOptions).reduce((result, key) => { + if (NON_VARIABLE_OPTIONS.includes(key)) { + result[key] = parsedOptions[key]; + return result; + } + + if (!result.variables) { + result.variables = {}; + } + + result.variables[key] = parsedOptions[key]; + return result; + }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix + // https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451 + + const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl; + + if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) { + requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql"); + } + + return request(requestOptions).then(response => { + if (response.data.errors) { + const headers = {}; + + for (const key of Object.keys(response.headers)) { + headers[key] = response.headers[key]; + } + + throw new GraphqlResponseError(requestOptions, headers, response.data); + } + + return response.data.data; + }); +} + +function withDefaults(request$1, newDefaults) { + const newRequest = request$1.defaults(newDefaults); + + const newApi = (query, options) => { + return graphql(newRequest, query, options); + }; + + return Object.assign(newApi, { + defaults: withDefaults.bind(null, newRequest), + endpoint: request.request.endpoint + }); +} + +const graphql$1 = withDefaults(request.request, { + headers: { + "user-agent": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}` + }, + method: "POST", + url: "/graphql" +}); +function withCustomRequest(customRequest) { + return withDefaults(customRequest, { + method: "POST", + url: "/graphql" + }); +} + +exports.GraphqlResponseError = GraphqlResponseError; +exports.graphql = graphql$1; +exports.withCustomRequest = withCustomRequest; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 537: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var deprecation = __nccwpck_require__(8932); +var once = _interopDefault(__nccwpck_require__(1223)); + +const logOnceCode = once(deprecation => console.warn(deprecation)); +const logOnceHeaders = once(deprecation => console.warn(deprecation)); +/** + * Error with extra properties to help with debugging + */ + +class RequestError extends Error { + constructor(message, statusCode, options) { + super(message); // Maintains proper stack trace (only available on V8) + + /* istanbul ignore next */ + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "HttpError"; + this.status = statusCode; + let headers; + + if ("headers" in options && typeof options.headers !== "undefined") { + headers = options.headers; + } + + if ("response" in options) { + this.response = options.response; + headers = options.response.headers; + } // redact request credentials without mutating original request options + + + const requestCopy = Object.assign({}, options.request); + + if (options.request.headers.authorization) { + requestCopy.headers = Object.assign({}, options.request.headers, { + authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]") + }); + } + + requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit + // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications + .replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended + // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header + .replace(/\baccess_token=\w+/g, "access_token=[REDACTED]"); + this.request = requestCopy; // deprecations + + Object.defineProperty(this, "code", { + get() { + logOnceCode(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`.")); + return statusCode; + } + + }); + Object.defineProperty(this, "headers", { + get() { + logOnceHeaders(new deprecation.Deprecation("[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`.")); + return headers || {}; + } + + }); + } + +} + +exports.RequestError = RequestError; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 6234: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var endpoint = __nccwpck_require__(9440); +var universalUserAgent = __nccwpck_require__(5030); +var isPlainObject = __nccwpck_require__(3287); +var nodeFetch = _interopDefault(__nccwpck_require__(467)); +var requestError = __nccwpck_require__(537); + +const VERSION = "5.6.3"; + +function getBufferResponse(response) { + return response.arrayBuffer(); +} + +function fetchWrapper(requestOptions) { + const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; + + if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { + requestOptions.body = JSON.stringify(requestOptions.body); + } + + let headers = {}; + let status; + let url; + const fetch = requestOptions.request && requestOptions.request.fetch || nodeFetch; + return fetch(requestOptions.url, Object.assign({ + method: requestOptions.method, + body: requestOptions.body, + headers: requestOptions.headers, + redirect: requestOptions.redirect + }, // `requestOptions.request.agent` type is incompatible + // see https://github.com/octokit/types.ts/pull/264 + requestOptions.request)).then(async response => { + url = response.url; + status = response.status; + + for (const keyAndValue of response.headers) { + headers[keyAndValue[0]] = keyAndValue[1]; + } + + if ("deprecation" in headers) { + const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/); + const deprecationLink = matches && matches.pop(); + log.warn(`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`); + } + + if (status === 204 || status === 205) { + return; + } // GitHub API returns 200 for HEAD requests + + + if (requestOptions.method === "HEAD") { + if (status < 400) { + return; + } + + throw new requestError.RequestError(response.statusText, status, { + response: { + url, + status, + headers, + data: undefined + }, + request: requestOptions + }); + } + + if (status === 304) { + throw new requestError.RequestError("Not modified", status, { + response: { + url, + status, + headers, + data: await getResponseData(response) + }, + request: requestOptions + }); + } -/***/ 679: -/***/ ((module) => { + if (status >= 400) { + const data = await getResponseData(response); + const error = new requestError.RequestError(toErrorMessage(data), status, { + response: { + url, + status, + headers, + data + }, + request: requestOptions + }); + throw error; + } -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __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()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) 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 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); -}); + return getResponseData(response); + }).then(data => { + return { + status, + url, + headers, + data + }; + }).catch(error => { + if (error instanceof requestError.RequestError) throw error; + throw new requestError.RequestError(error.message, 500, { + request: requestOptions + }); + }); +} + +async function getResponseData(response) { + const contentType = response.headers.get("content-type"); + + if (/application\/json/.test(contentType)) { + return response.json(); + } + + if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) { + return response.text(); + } + + return getBufferResponse(response); +} + +function toErrorMessage(data) { + if (typeof data === "string") return data; // istanbul ignore else - just in case + + if ("message" in data) { + if (Array.isArray(data.errors)) { + return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`; + } + + return data.message; + } // istanbul ignore next - just in case + + + return `Unknown error: ${JSON.stringify(data)}`; +} + +function withDefaults(oldEndpoint, newDefaults) { + const endpoint = oldEndpoint.defaults(newDefaults); + + const newApi = function (route, parameters) { + const endpointOptions = endpoint.merge(route, parameters); + + if (!endpointOptions.request || !endpointOptions.request.hook) { + return fetchWrapper(endpoint.parse(endpointOptions)); + } + + const request = (route, parameters) => { + return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters))); + }; + + Object.assign(request, { + endpoint, + defaults: withDefaults.bind(null, endpoint) + }); + return endpointOptions.request.hook(request, endpointOptions); + }; + + return Object.assign(newApi, { + endpoint, + defaults: withDefaults.bind(null, endpoint) + }); +} + +const request = withDefaults(endpoint.endpoint, { + headers: { + "user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}` + } +}); + +exports.request = request; +//# sourceMappingURL=index.js.map /***/ }), @@ -47487,6 +50116,183 @@ function range(a, b, str) { } +/***/ }), + +/***/ 3682: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var register = __nccwpck_require__(4670) +var addHook = __nccwpck_require__(5549) +var removeHook = __nccwpck_require__(6819) + +// bind with array of arguments: https://stackoverflow.com/a/21792913 +var bind = Function.bind +var bindable = bind.bind(bind) + +function bindApi (hook, state, name) { + var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state]) + hook.api = { remove: removeHookRef } + hook.remove = removeHookRef + + ;['before', 'error', 'after', 'wrap'].forEach(function (kind) { + var args = name ? [state, kind, name] : [state, kind] + hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args) + }) +} + +function HookSingular () { + var singularHookName = 'h' + var singularHookState = { + registry: {} + } + var singularHook = register.bind(null, singularHookState, singularHookName) + bindApi(singularHook, singularHookState, singularHookName) + return singularHook +} + +function HookCollection () { + var state = { + registry: {} + } + + var hook = register.bind(null, state) + bindApi(hook, state) + + return hook +} + +var collectionHookDeprecationMessageDisplayed = false +function Hook () { + if (!collectionHookDeprecationMessageDisplayed) { + console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4') + collectionHookDeprecationMessageDisplayed = true + } + return HookCollection() +} + +Hook.Singular = HookSingular.bind() +Hook.Collection = HookCollection.bind() + +module.exports = Hook +// expose constructors as a named property for TypeScript +module.exports.Hook = Hook +module.exports.Singular = Hook.Singular +module.exports.Collection = Hook.Collection + + +/***/ }), + +/***/ 5549: +/***/ ((module) => { + +module.exports = addHook; + +function addHook(state, kind, name, hook) { + var orig = hook; + if (!state.registry[name]) { + state.registry[name] = []; + } + + if (kind === "before") { + hook = function (method, options) { + return Promise.resolve() + .then(orig.bind(null, options)) + .then(method.bind(null, options)); + }; + } + + if (kind === "after") { + hook = function (method, options) { + var result; + return Promise.resolve() + .then(method.bind(null, options)) + .then(function (result_) { + result = result_; + return orig(result, options); + }) + .then(function () { + return result; + }); + }; + } + + if (kind === "error") { + hook = function (method, options) { + return Promise.resolve() + .then(method.bind(null, options)) + .catch(function (error) { + return orig(error, options); + }); + }; + } + + state.registry[name].push({ + hook: hook, + orig: orig, + }); +} + + +/***/ }), + +/***/ 4670: +/***/ ((module) => { + +module.exports = register; + +function register(state, name, method, options) { + if (typeof method !== "function") { + throw new Error("method for before hook must be a function"); + } + + if (!options) { + options = {}; + } + + if (Array.isArray(name)) { + return name.reverse().reduce(function (callback, name) { + return register.bind(null, state, name, callback, options); + }, method)(); + } + + return Promise.resolve().then(function () { + if (!state.registry[name]) { + return method(options); + } + + return state.registry[name].reduce(function (method, registered) { + return registered.hook.bind(null, method, options); + }, method)(); + }); +} + + +/***/ }), + +/***/ 6819: +/***/ ((module) => { + +module.exports = removeHook; + +function removeHook(state, name, method) { + if (!state.registry[name]) { + return; + } + + var index = state.registry[name] + .map(function (registered) { + return registered.orig; + }) + .indexOf(method); + + if (index === -1) { + return; + } + + state.registry[name].splice(index, 1); +} + + /***/ }), /***/ 3717: @@ -48044,6 +50850,80 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { }; +/***/ }), + +/***/ 8932: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +class Deprecation extends Error { + constructor(message) { + super(message); // Maintains proper stack trace (only available on V8) + + /* istanbul ignore next */ + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = 'Deprecation'; + } + +} + +exports.Deprecation = Deprecation; + + +/***/ }), + +/***/ 3287: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +function isObject(o) { + return Object.prototype.toString.call(o) === '[object Object]'; +} + +function isPlainObject(o) { + var ctor,prot; + + if (isObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (ctor === undefined) return true; + + // If has modified prototype + prot = ctor.prototype; + if (isObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; +} + +exports.isPlainObject = isPlainObject; + + /***/ }), /***/ 7426: @@ -53080,6 +55960,55 @@ module.exports.implForWrapper = function (wrapper) { +/***/ }), + +/***/ 1223: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var wrappy = __nccwpck_require__(2940) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} + + /***/ }), /***/ 9975: @@ -57432,6 +60361,32 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { exports.debug = debug; // for test +/***/ }), + +/***/ 5030: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function getUserAgent() { + if (typeof navigator === "object" && "userAgent" in navigator) { + return navigator.userAgent; + } + + if (typeof process === "object" && "version" in process) { + return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`; + } + + return ""; +} + +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ 9046: @@ -58712,6 +61667,46 @@ function version(uuid) { var _default = version; exports["default"] = _default; +/***/ }), + +/***/ 2940: +/***/ ((module) => { + +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} + + /***/ }), /***/ 2624: @@ -64000,6 +66995,8 @@ exports.run = void 0; const core = __importStar(__nccwpck_require__(2186)); const constants = __importStar(__nccwpck_require__(9042)); const cache_1 = __nccwpck_require__(4810); +const reports_1 = __nccwpck_require__(94); +const options_1 = __nccwpck_require__(6159); /** * Check given input and run a save process for the specified package manager * @returns Promise that will be resolved when the save process finishes @@ -64031,6 +67028,17 @@ function ignoreError(promise) { } function run() { return __awaiter(this, void 0, void 0, function* () { + let reported = false; + if (yield options_1.isNativeImageBuildReport()) { + reports_1.createNIBuildReport(); + reported = true; + } + if (yield options_1.isNativeImageArtifactReport()) { + reports_1.createNIArtifactReport(); + reported = true; + } + if (reported) + core.summary.write(); yield ignoreError(saveCache()); }); } @@ -64052,7 +67060,7 @@ else { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_BUILD = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -64061,6 +67069,8 @@ exports.INPUT_GITHUB_TOKEN = 'github-token'; exports.INPUT_SET_JAVA_HOME = 'set-java-home'; exports.INPUT_CACHE = 'cache'; exports.INPUT_NI_MUSL = 'native-image-musl'; +exports.INPUT_NI_REPORT_BUILD = 'native-image-report-build'; +exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact'; exports.IS_LINUX = process.platform === 'linux'; exports.IS_MACOS = process.platform === 'darwin'; exports.IS_WINDOWS = process.platform === 'win32'; @@ -64074,6 +67084,7 @@ exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : ''; exports.MANDREL_NAMESPACE = 'mandrel-'; exports.GDS_BASE = 'https://gds.oracle.com/api/20220101'; exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'; +exports.NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties'; function determineGraalVMArchitecture() { switch (process.arch) { case 'x64': { @@ -64089,6 +67100,520 @@ function determineGraalVMArchitecture() { } +/***/ }), + +/***/ 1833: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PEAK_RSS_BYTES = exports.SYSTEM_TOTAL = exports.TOTAL_SECS = exports.TOTAL_CORES = exports.LOAD = exports.RESOURCES = exports.COMPILATION_UNITS = exports.BYTES = exports.FIELDS = exports.CLASSES = exports.METHODS = exports.GRAALVM_VERSION = exports.GARBAGE_COLLECTOR = exports.JAVA_VERSION = exports.NAME = exports.C_COMPILER = exports.IMAGE_HEAP = exports.TOTAL_BYTES = exports.CODE_AREA = exports.CPU = exports.GARBAGE_COLLECTION = exports.MEMORY = exports.ANALYSIS_RESULTS = exports.GENERAL_INFO = exports.IMAGE_DETAILS = exports.RESOURCE_USAGE = exports.COUNT = void 0; +exports.COUNT = "count"; +exports.RESOURCE_USAGE = "resource_usage"; +exports.IMAGE_DETAILS = "image_details"; +exports.GENERAL_INFO = "general_info"; +exports.ANALYSIS_RESULTS = "analysis_results"; +exports.MEMORY = "memory"; +exports.GARBAGE_COLLECTION = "garbage_collection"; +exports.CPU = "cpu"; +exports.CODE_AREA = "code_area"; +exports.TOTAL_BYTES = "total_bytes"; +exports.IMAGE_HEAP = "image_heap"; +exports.C_COMPILER = "c_compiler"; +exports.NAME = "name"; +exports.JAVA_VERSION = "java_version"; +exports.GARBAGE_COLLECTOR = "garbage_collector"; +exports.GRAALVM_VERSION = "graalvm_version"; +exports.METHODS = "methods"; +exports.CLASSES = "classes"; +exports.FIELDS = "fields"; +exports.BYTES = "bytes"; +exports.COMPILATION_UNITS = "compilation_units"; +exports.RESOURCES = "resources"; +exports.LOAD = "load"; +exports.TOTAL_CORES = "total_cores"; +exports.TOTAL_SECS = "total_secs"; +exports.SYSTEM_TOTAL = "system_total"; +exports.PEAK_RSS_BYTES = "peak_rss_bytes"; + + +/***/ }), + +/***/ 6014: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TOTAL = exports.SIZE = exports.NAME = exports.COUNT = exports.CODE_BREAKDOWN = exports.HEAP_BREAKDOWN = exports.CODE_SIZE = exports.HEAP_SIZE = void 0; +exports.HEAP_SIZE = "heap-size"; +exports.CODE_SIZE = "code-size"; +exports.HEAP_BREAKDOWN = "heap-breakdown"; +exports.CODE_BREAKDOWN = "code-breakdown"; +exports.COUNT = "count"; +exports.NAME = "name"; +exports.SIZE = "size"; +exports.TOTAL = "total"; + + +/***/ }), + +/***/ 5609: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getVersionString = exports.setUpGUComponents = void 0; +const constants_1 = __nccwpck_require__(9042); +const utils_1 = __nccwpck_require__(1314); +const path_1 = __nccwpck_require__(1017); +const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']; +const COMPONENT_TO_POST_INSTALL_HOOK = new Map([ + [ + 'linux', + new Map([ + ['ruby', 'languages/ruby/lib/truffle/post_install_hook.sh'] + // ['R', 'languages/R/bin/configure_fastr'] (GR-36105: cannot be run non-interactively) + ]) + ], + [ + 'darwin', + new Map([ + ['ruby', 'languages/ruby/lib/truffle/post_install_hook.sh'] + // ['R', 'languages/R/bin/configure_fastr'] (GR-36105: cannot be run non-interactively) + ]) + ] + // No post install hooks for Windows (yet) +]); +function setUpGUComponents(gdsToken, graalVMHome, components) { + return __awaiter(this, void 0, void 0, function* () { + yield utils_1.exec('gu', BASE_FLAGS.concat(components), { + env: Object.assign(Object.assign({}, process.env), { GRAAL_EE_DOWNLOAD_TOKEN: gdsToken }) + }); + const platformHooks = COMPONENT_TO_POST_INSTALL_HOOK.get(constants_1.GRAALVM_PLATFORM); + if (platformHooks) { + for (const component of components) { + const postInstallHook = platformHooks.get(component); + if (postInstallHook) { + yield utils_1.exec(`"${path_1.join(graalVMHome, postInstallHook)}"`); + } + } + } + }); +} +exports.setUpGUComponents = setUpGUComponents; +function getVersionString() { + return __awaiter(this, void 0, void 0, function* () { + let output = ""; + const options = { + listeners: { + stdout: (data) => { + output += data.toString(); + } + } + }; + yield utils_1.exec('gu', ['--version'], options); + const versionParts = output.split(' '); + return versionParts[versionParts.length - 1]; + }); +} +exports.getVersionString = getVersionString; + + +/***/ }), + +/***/ 6159: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isNativeImageArtifactReport = exports.isNativeImageBuildReport = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const c = __importStar(__nccwpck_require__(9042)); +const utils_1 = __nccwpck_require__(1314); +function isNativeImageBuildReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); + }); +} +exports.isNativeImageBuildReport = isNativeImageBuildReport; +function isNativeImageArtifactReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); + }); +} +exports.isNativeImageArtifactReport = isNativeImageArtifactReport; + + +/***/ }), + +/***/ 94: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; +const fs = __importStar(__nccwpck_require__(7147)); +const core = __importStar(__nccwpck_require__(2186)); +const utils_1 = __nccwpck_require__(1314); +const dashboardNIDef_1 = __nccwpck_require__(6014); +const buildOutputDef_1 = __nccwpck_require__(1833); +function setUpNIArtifactReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + yield utils_1.setNativeImageOption("-H:+DashboardCode"); + yield utils_1.setNativeImageOption("-H:+DashboardHeap"); + yield utils_1.setNativeImageOption("-H:-DashboardBgv"); + yield utils_1.setNativeImageOption("-H:+DashboardJson"); + yield utils_1.setNativeImageOption("-H:DashboardDump=artifactReport"); + }); +} +exports.setUpNIArtifactReport = setUpNIArtifactReport; +function setUpNIBuildReport() { + return __awaiter(this, void 0, void 0, function* () { + yield utils_1.setNativeImageOption("-H:BuildOutputJSONFile=outputReport.json"); + }); +} +exports.setUpNIBuildReport = setUpNIBuildReport; +function createNIArtifactReport() { + const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); + const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; + const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; + let heap = heapBreakdown[dashboardNIDef_1.HEAP_SIZE]; + let code = codeBreakdown[dashboardNIDef_1.CODE_SIZE]; + heap.sort((v1, v2) => v2.size - v1.size); + heap = heap.slice(0, 10); + code = aggregateCode(code); + code.sort((v1, v2) => v2.size - v1.size); + code = code.slice(0, 10); + const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); + const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); + addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", value: heapSum }, { name: "Code size", value: codeSum }); + addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); + addTableSummary("10 Top Code sizes", ["Name", "Size", "%"], ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); +} +exports.createNIArtifactReport = createNIArtifactReport; +function createNIBuildReport() { + const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); + addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); + addTableSummaryNoHeader("Resource usage", ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); + addTableSummary("Analysis Results", ["Type", "Total", "Reflection", "JNI", "Reachable"], ...Object.entries(data[buildOutputDef_1.ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); +} +exports.createNIBuildReport = createNIBuildReport; +function analysisResultEntryToTableRow(entry) { + return [entry[0], + `${entry[1].total}`, + `${entry[1].reflection}`, + `${entry[1].jni}`, + `${entry[1].reachable}`]; +} +function imageDetailsToTableRows(imageDetails) { + const out = []; + const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; + out.push(["Heap", `${imageHeap[buildOutputDef_1.BYTES]}`]); + out.push(["Resources", `${imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES]}`]); + out.push(["Code", `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]}`]); + out.push(["Total", `${imageDetails[buildOutputDef_1.TOTAL_BYTES]}`]); + return out; +} +function resourceUsageToTableRows(resourceUsage) { + const out = []; + out.push(["Memory usage", resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL] + " B"]); + out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES]).toFixed(2) + "%"]); + return out; +} +function aggregateCode(code) { + const aggregates = new Map(); + code.forEach(element => { + const pkg = parsePkg(element.name); + aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); + }); + code = []; + aggregates.forEach((s, n) => code.push({ name: n, size: s })); + return code; +} +function parsePkg(name) { + const parts = name.split('.'); + let pkg = []; + for (const part of parts) { + if (part === part.toLowerCase()) { + pkg.push(part); + } + else + break; + } + return pkg.join('.'); +} +function addMermaidPieSummary(title, showData, ...data) { + //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n + core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); +} +function addTableSummary(title, colNames, ...data) { + const rows = []; + rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); + rows.push(colNames.map(name => { return { data: name, header: true }; })); + core.summary.addTable(rows.concat(data)); +} +function addTableSummaryNoHeader(title, ...data) { + const rows = []; + let max = 0; + for (const row of data) { + max = Math.max(row.length, max); + } + rows.push([{ data: title, header: true, colspan: `${max}` }]); + core.summary.addTable(rows.concat(data)); +} + + +/***/ }), + +/***/ 1314: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +const c = __importStar(__nccwpck_require__(9042)); +const gu_1 = __nccwpck_require__(5609); +const core = __importStar(__nccwpck_require__(2186)); +const httpClient = __importStar(__nccwpck_require__(9925)); +const tc = __importStar(__nccwpck_require__(7784)); +const exec_1 = __nccwpck_require__(1514); +const fs_1 = __nccwpck_require__(7147); +const core_1 = __nccwpck_require__(6762); +const crypto_1 = __nccwpck_require__(6113); +const path_1 = __nccwpck_require__(1017); +const fs = __importStar(__nccwpck_require__(7147)); +// Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) +const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'; +const GitHub = core_1.Octokit.defaults({ + baseUrl, + request: { + agent: new httpClient.HttpClient().getAgent(baseUrl) + } +}); +function exec(commandLine, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const exitCode = yield exec_1.exec(commandLine, args, options); + if (exitCode !== 0) { + throw new Error(`'${[commandLine] + .concat(args || []) + .join(' ')}' exited with a non-zero code: ${exitCode}`); + } + }); +} +exports.exec = exec; +function getLatestRelease(repo) { + return __awaiter(this, void 0, void 0, function* () { + const githubToken = core.getInput('github-token'); + const options = githubToken.length > 0 ? { auth: githubToken } : {}; + const octokit = new GitHub(options); + return (yield octokit.request('GET /repos/{owner}/{repo}/releases/latest', { + owner: c.GRAALVM_GH_USER, + repo + })).data; + }); +} +exports.getLatestRelease = getLatestRelease; +function downloadAndExtractJDK(downloadUrl) { + return __awaiter(this, void 0, void 0, function* () { + return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl))); + }); +} +exports.downloadAndExtractJDK = downloadAndExtractJDK; +function downloadExtractAndCacheJDK(downloader, toolName, version) { + return __awaiter(this, void 0, void 0, function* () { + const semVersion = toSemVer(version); + let toolPath = tc.find(toolName, semVersion); + if (toolPath) { + core.info(`Found ${toolName} ${version} in tool-cache @ ${toolPath}`); + } + else { + const extractDir = yield extract(yield downloader()); + core.info(`Adding ${toolName} ${version} to tool-cache ...`); + toolPath = yield tc.cacheDir(extractDir, toolName, semVersion); + } + return findJavaHomeInSubfolder(toolPath); + }); +} +exports.downloadExtractAndCacheJDK = downloadExtractAndCacheJDK; +function calculateSHA256(filePath) { + const hashSum = crypto_1.createHash('sha256'); + hashSum.update(fs_1.readFileSync(filePath)); + return hashSum.digest('hex'); +} +exports.calculateSHA256 = calculateSHA256; +function extract(downloadPath) { + return __awaiter(this, void 0, void 0, function* () { + if (c.GRAALVM_FILE_EXTENSION === '.tar.gz') { + return yield tc.extractTar(downloadPath); + } + else if (c.GRAALVM_FILE_EXTENSION === '.zip') { + return yield tc.extractZip(downloadPath); + } + else { + throw new Error(`Unexpected filetype downloaded: ${c.GRAALVM_FILE_EXTENSION}`); + } + }); +} +function findJavaHomeInSubfolder(searchPath) { + const baseContents = fs_1.readdirSync(searchPath); + if (baseContents.length === 1) { + return path_1.join(searchPath, baseContents[0], c.JDK_HOME_SUFFIX); + } + else { + throw new Error(`Unexpected amount of directory items found: ${baseContents.length}`); + } +} +/** + * This helper turns GraalVM version numbers (e.g., `22.0.0.2`) into valid + * semver.org versions (e.g., `22.0.0-2`), which is needed because + * @actions/tool-cache uses `semver` to validate versions. + */ +function toSemVer(version) { + const parts = version.split('.'); + const major = parts[0]; + const minor = parts.length > 1 ? parts[1] : '0'; + const patch = parts.length > 2 ? parts.slice(2).join('-') : '0'; + return `${major}.${minor}.${patch}`; +} +function getNativeImageOptionsFile() { + let optionsFile = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + if (optionsFile === undefined) + core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + return optionsFile; +} +function setNativeImageOption(value) { + return __awaiter(this, void 0, void 0, function* () { + let optionsFile = getNativeImageOptionsFile(); + if (fs.existsSync(optionsFile)) { + fs.appendFileSync(optionsFile, " " + value); + } + else { + fs.writeFileSync(optionsFile, "NativeImageArgs = " + value); + } + }); +} +exports.setNativeImageOption = setNativeImageOption; +function getGVMversion() { + return __awaiter(this, void 0, void 0, function* () { + const versionString = yield gu_1.getVersionString(); + const devParts = versionString.split('-'); + const versionParts = devParts[0].split('.'); + return { + major: parseInt(versionParts[0]) || 0, + minor: parseInt(versionParts[1]) || 0, + patch: parseInt(versionParts[2]) || 0, + hotfix: parseInt(versionParts[3]) || 0, + dev: devParts[1] === 'dev' + }; + }); +} +exports.getGVMversion = getGVMversion; + + /***/ }), /***/ 2877: diff --git a/dist/main/index.js b/dist/main/index.js index 9863dd6..ef64d9e 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -66938,7 +66938,7 @@ function isProbablyGradleDaemonProblem(packageManager, error) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_BUILD = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -66947,6 +66947,8 @@ exports.INPUT_GITHUB_TOKEN = 'github-token'; exports.INPUT_SET_JAVA_HOME = 'set-java-home'; exports.INPUT_CACHE = 'cache'; exports.INPUT_NI_MUSL = 'native-image-musl'; +exports.INPUT_NI_REPORT_BUILD = 'native-image-report-build'; +exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact'; exports.IS_LINUX = process.platform === 'linux'; exports.IS_MACOS = process.platform === 'darwin'; exports.IS_WINDOWS = process.platform === 'win32'; @@ -66960,6 +66962,7 @@ exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : ''; exports.MANDREL_NAMESPACE = 'mandrel-'; exports.GDS_BASE = 'https://gds.oracle.com/api/20220101'; exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'; +exports.NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties'; function determineGraalVMArchitecture() { switch (process.arch) { case 'x64': { @@ -66975,6 +66978,63 @@ function determineGraalVMArchitecture() { } +/***/ }), + +/***/ 1833: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PEAK_RSS_BYTES = exports.SYSTEM_TOTAL = exports.TOTAL_SECS = exports.TOTAL_CORES = exports.LOAD = exports.RESOURCES = exports.COMPILATION_UNITS = exports.BYTES = exports.FIELDS = exports.CLASSES = exports.METHODS = exports.GRAALVM_VERSION = exports.GARBAGE_COLLECTOR = exports.JAVA_VERSION = exports.NAME = exports.C_COMPILER = exports.IMAGE_HEAP = exports.TOTAL_BYTES = exports.CODE_AREA = exports.CPU = exports.GARBAGE_COLLECTION = exports.MEMORY = exports.ANALYSIS_RESULTS = exports.GENERAL_INFO = exports.IMAGE_DETAILS = exports.RESOURCE_USAGE = exports.COUNT = void 0; +exports.COUNT = "count"; +exports.RESOURCE_USAGE = "resource_usage"; +exports.IMAGE_DETAILS = "image_details"; +exports.GENERAL_INFO = "general_info"; +exports.ANALYSIS_RESULTS = "analysis_results"; +exports.MEMORY = "memory"; +exports.GARBAGE_COLLECTION = "garbage_collection"; +exports.CPU = "cpu"; +exports.CODE_AREA = "code_area"; +exports.TOTAL_BYTES = "total_bytes"; +exports.IMAGE_HEAP = "image_heap"; +exports.C_COMPILER = "c_compiler"; +exports.NAME = "name"; +exports.JAVA_VERSION = "java_version"; +exports.GARBAGE_COLLECTOR = "garbage_collector"; +exports.GRAALVM_VERSION = "graalvm_version"; +exports.METHODS = "methods"; +exports.CLASSES = "classes"; +exports.FIELDS = "fields"; +exports.BYTES = "bytes"; +exports.COMPILATION_UNITS = "compilation_units"; +exports.RESOURCES = "resources"; +exports.LOAD = "load"; +exports.TOTAL_CORES = "total_cores"; +exports.TOTAL_SECS = "total_secs"; +exports.SYSTEM_TOTAL = "system_total"; +exports.PEAK_RSS_BYTES = "peak_rss_bytes"; + + +/***/ }), + +/***/ 6014: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TOTAL = exports.SIZE = exports.NAME = exports.COUNT = exports.CODE_BREAKDOWN = exports.HEAP_BREAKDOWN = exports.CODE_SIZE = exports.HEAP_SIZE = void 0; +exports.HEAP_SIZE = "heap-size"; +exports.CODE_SIZE = "code-size"; +exports.HEAP_BREAKDOWN = "heap-breakdown"; +exports.CODE_BREAKDOWN = "code-breakdown"; +exports.COUNT = "count"; +exports.NAME = "name"; +exports.SIZE = "size"; +exports.TOTAL = "total"; + + /***/ }), /***/ 7760: @@ -67438,7 +67498,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.setUpGUComponents = void 0; +exports.getVersionString = exports.setUpGUComponents = void 0; const constants_1 = __nccwpck_require__(9042); const utils_1 = __nccwpck_require__(1314); const path_1 = __nccwpck_require__(1017); @@ -67477,6 +67537,22 @@ function setUpGUComponents(gdsToken, graalVMHome, components) { }); } exports.setUpGUComponents = setUpGUComponents; +function getVersionString() { + return __awaiter(this, void 0, void 0, function* () { + let output = ""; + const options = { + listeners: { + stdout: (data) => { + output += data.toString(); + } + } + }; + yield utils_1.exec('gu', ['--version'], options); + const versionParts = output.split(' '); + return versionParts[versionParts.length - 1]; + }); +} +exports.getVersionString = getVersionString; /***/ }), @@ -67526,6 +67602,8 @@ const gu_1 = __nccwpck_require__(5609); const mandrel_1 = __nccwpck_require__(8766); const features_1 = __nccwpck_require__(7216); const msvc_1 = __nccwpck_require__(1165); +const options_1 = __nccwpck_require__(6159); +const reports_1 = __nccwpck_require__(94); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -67578,6 +67656,18 @@ function run() { yield gu_1.setUpGUComponents(gdsToken, graalVMHome, components); } } + if (yield options_1.isNativeImageArtifactReport()) { + yield reports_1.setUpNIArtifactReport(); + } + else if (core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT)) { + core.notice(`Artifact report isn't available for GraalVM version ${graalvmVersion}.`); + } + if (yield options_1.isNativeImageBuildReport()) { + yield reports_1.setUpNIBuildReport(); + } + else if (core.getBooleanInput(c.INPUT_NI_REPORT_BUILD)) { + core.notice(`Build report isn't available for GraalVM version ${graalvmVersion}.`); + } if (cache && cache_1.isFeatureAvailable()) { yield cache_2.restore(cache); } @@ -67760,6 +67850,213 @@ function setUpWindowsEnvironment() { exports.setUpWindowsEnvironment = setUpWindowsEnvironment; +/***/ }), + +/***/ 6159: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isNativeImageArtifactReport = exports.isNativeImageBuildReport = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const c = __importStar(__nccwpck_require__(9042)); +const utils_1 = __nccwpck_require__(1314); +function isNativeImageBuildReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); + }); +} +exports.isNativeImageBuildReport = isNativeImageBuildReport; +function isNativeImageArtifactReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); + }); +} +exports.isNativeImageArtifactReport = isNativeImageArtifactReport; + + +/***/ }), + +/***/ 94: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; +const fs = __importStar(__nccwpck_require__(7147)); +const core = __importStar(__nccwpck_require__(2186)); +const utils_1 = __nccwpck_require__(1314); +const dashboardNIDef_1 = __nccwpck_require__(6014); +const buildOutputDef_1 = __nccwpck_require__(1833); +function setUpNIArtifactReport() { + return __awaiter(this, void 0, void 0, function* () { + const version = yield utils_1.getGVMversion(); + yield utils_1.setNativeImageOption("-H:+DashboardCode"); + yield utils_1.setNativeImageOption("-H:+DashboardHeap"); + yield utils_1.setNativeImageOption("-H:-DashboardBgv"); + yield utils_1.setNativeImageOption("-H:+DashboardJson"); + yield utils_1.setNativeImageOption("-H:DashboardDump=artifactReport"); + }); +} +exports.setUpNIArtifactReport = setUpNIArtifactReport; +function setUpNIBuildReport() { + return __awaiter(this, void 0, void 0, function* () { + yield utils_1.setNativeImageOption("-H:BuildOutputJSONFile=outputReport.json"); + }); +} +exports.setUpNIBuildReport = setUpNIBuildReport; +function createNIArtifactReport() { + const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); + const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; + const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; + let heap = heapBreakdown[dashboardNIDef_1.HEAP_SIZE]; + let code = codeBreakdown[dashboardNIDef_1.CODE_SIZE]; + heap.sort((v1, v2) => v2.size - v1.size); + heap = heap.slice(0, 10); + code = aggregateCode(code); + code.sort((v1, v2) => v2.size - v1.size); + code = code.slice(0, 10); + const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); + const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); + addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", value: heapSum }, { name: "Code size", value: codeSum }); + addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); + addTableSummary("10 Top Code sizes", ["Name", "Size", "%"], ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); +} +exports.createNIArtifactReport = createNIArtifactReport; +function createNIBuildReport() { + const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); + addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); + addTableSummaryNoHeader("Resource usage", ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); + addTableSummary("Analysis Results", ["Type", "Total", "Reflection", "JNI", "Reachable"], ...Object.entries(data[buildOutputDef_1.ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); +} +exports.createNIBuildReport = createNIBuildReport; +function analysisResultEntryToTableRow(entry) { + return [entry[0], + `${entry[1].total}`, + `${entry[1].reflection}`, + `${entry[1].jni}`, + `${entry[1].reachable}`]; +} +function imageDetailsToTableRows(imageDetails) { + const out = []; + const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; + out.push(["Heap", `${imageHeap[buildOutputDef_1.BYTES]}`]); + out.push(["Resources", `${imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES]}`]); + out.push(["Code", `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]}`]); + out.push(["Total", `${imageDetails[buildOutputDef_1.TOTAL_BYTES]}`]); + return out; +} +function resourceUsageToTableRows(resourceUsage) { + const out = []; + out.push(["Memory usage", resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL] + " B"]); + out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES]).toFixed(2) + "%"]); + return out; +} +function aggregateCode(code) { + const aggregates = new Map(); + code.forEach(element => { + const pkg = parsePkg(element.name); + aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); + }); + code = []; + aggregates.forEach((s, n) => code.push({ name: n, size: s })); + return code; +} +function parsePkg(name) { + const parts = name.split('.'); + let pkg = []; + for (const part of parts) { + if (part === part.toLowerCase()) { + pkg.push(part); + } + else + break; + } + return pkg.join('.'); +} +function addMermaidPieSummary(title, showData, ...data) { + //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n + core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); +} +function addTableSummary(title, colNames, ...data) { + const rows = []; + rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); + rows.push(colNames.map(name => { return { data: name, header: true }; })); + core.summary.addTable(rows.concat(data)); +} +function addTableSummaryNoHeader(title, ...data) { + const rows = []; + let max = 0; + for (const row of data) { + max = Math.max(row.length, max); + } + rows.push([{ data: title, header: true, colspan: `${max}` }]); + core.summary.addTable(rows.concat(data)); +} + + /***/ }), /***/ 1314: @@ -67796,8 +68093,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; const c = __importStar(__nccwpck_require__(9042)); +const gu_1 = __nccwpck_require__(5609); const core = __importStar(__nccwpck_require__(2186)); const httpClient = __importStar(__nccwpck_require__(9925)); const tc = __importStar(__nccwpck_require__(7784)); @@ -67806,6 +68104,7 @@ const fs_1 = __nccwpck_require__(7147); const core_1 = __nccwpck_require__(6762); const crypto_1 = __nccwpck_require__(6113); const path_1 = __nccwpck_require__(1017); +const fs = __importStar(__nccwpck_require__(7147)); // Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'; const GitHub = core_1.Octokit.defaults({ @@ -67899,6 +68198,39 @@ function toSemVer(version) { const patch = parts.length > 2 ? parts.slice(2).join('-') : '0'; return `${major}.${minor}.${patch}`; } +function getNativeImageOptionsFile() { + let optionsFile = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + if (optionsFile === undefined) + core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + return optionsFile; +} +function setNativeImageOption(value) { + return __awaiter(this, void 0, void 0, function* () { + let optionsFile = getNativeImageOptionsFile(); + if (fs.existsSync(optionsFile)) { + fs.appendFileSync(optionsFile, " " + value); + } + else { + fs.writeFileSync(optionsFile, "NativeImageArgs = " + value); + } + }); +} +exports.setNativeImageOption = setNativeImageOption; +function getGVMversion() { + return __awaiter(this, void 0, void 0, function* () { + const versionString = yield gu_1.getVersionString(); + const devParts = versionString.split('-'); + const versionParts = devParts[0].split('.'); + return { + major: parseInt(versionParts[0]) || 0, + minor: parseInt(versionParts[1]) || 0, + patch: parseInt(versionParts[2]) || 0, + hotfix: parseInt(versionParts[3]) || 0, + dev: devParts[1] === 'dev' + }; + }); +} +exports.getGVMversion = getGVMversion; /***/ }), diff --git a/src/cleanup.ts b/src/cleanup.ts index dd631e6..6596bf3 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -26,7 +26,9 @@ import * as core from '@actions/core' import * as constants from './constants' -import {save} from './cache' +import { save } from './cache' +import { createNIArtifactReport, createNIBuildReport } from './reports' +import { isNativeImageBuildReport, isNativeImageArtifactReport } from './options' /** * Check given input and run a save process for the specified package manager @@ -55,7 +57,19 @@ async function ignoreError(promise: Promise): Promise { }) } + export async function run(): Promise { + let reported = false; + if (await isNativeImageBuildReport()) { + createNIBuildReport(); + reported = true; + } + if (await isNativeImageArtifactReport()) { + createNIArtifactReport(); + reported = true; + } + if (reported) + core.summary.write(); await ignoreError(saveCache()) } diff --git a/src/constants.ts b/src/constants.ts index bb4119b..58084e7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,6 +8,8 @@ export const INPUT_GITHUB_TOKEN = 'github-token' export const INPUT_SET_JAVA_HOME = 'set-java-home' export const INPUT_CACHE = 'cache' export const INPUT_NI_MUSL = 'native-image-musl' +export const INPUT_NI_REPORT_BUILD = 'native-image-report-build' +export const INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact' export const IS_LINUX = process.platform === 'linux' export const IS_MACOS = process.platform === 'darwin' @@ -27,6 +29,8 @@ export const MANDREL_NAMESPACE = 'mandrel-' export const GDS_BASE = 'https://gds.oracle.com/api/20220101' export const GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6' +export const NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties' + export type LatestReleaseResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response'] diff --git a/src/definitions/buildOutputDef.ts b/src/definitions/buildOutputDef.ts new file mode 100644 index 0000000..e5bda2e --- /dev/null +++ b/src/definitions/buildOutputDef.ts @@ -0,0 +1,41 @@ + +export const COUNT = "count"; +export const RESOURCE_USAGE = "resource_usage"; +export const IMAGE_DETAILS = "image_details"; +export const GENERAL_INFO = "general_info"; +export const ANALYSIS_RESULTS = "analysis_results"; +export const MEMORY = "memory"; +export const GARBAGE_COLLECTION = "garbage_collection"; +export const CPU = "cpu"; +export const CODE_AREA = "code_area"; +export const TOTAL_BYTES = "total_bytes"; +export const IMAGE_HEAP = "image_heap"; +export const C_COMPILER = "c_compiler"; +export const NAME = "name"; +export const JAVA_VERSION = "java_version"; +export const GARBAGE_COLLECTOR = "garbage_collector"; +export const GRAALVM_VERSION = "graalvm_version"; +export const METHODS = "methods"; +export const CLASSES = "classes"; +export const FIELDS = "fields"; +export const BYTES = "bytes"; +export const COMPILATION_UNITS = "compilation_units"; +export const RESOURCES = "resources"; +export const LOAD = "load"; +export const TOTAL_CORES = "total_cores"; +export const TOTAL_SECS = "total_secs"; +export const SYSTEM_TOTAL = "system_total"; +export const PEAK_RSS_BYTES = "peak_rss_bytes"; + +export type AnalysisResult = { total: number, reflection: number, jni: number, reachable: number }; +export type AnalysisResults = { [METHODS]: AnalysisResult, [CLASSES]: AnalysisResult, [FIELDS]: AnalysisResult }; +export type GeneralInfo = { [GRAALVM_VERSION]: string, [GARBAGE_COLLECTOR]: string, [JAVA_VERSION]: string, [NAME]: string, [C_COMPILER]: string }; +export type CodeArea = { [BYTES]: number, [COMPILATION_UNITS]: number }; +export type Resources = { [BYTES]: number, [COUNT]: number }; +export type ImageHeap = { [BYTES]: number, [RESOURCES]: Resources }; +export type ImageDetails = { [CODE_AREA]: CodeArea, [TOTAL_BYTES]: number, [IMAGE_HEAP]: ImageHeap }; +export type Cpu = { [LOAD]: number, [TOTAL_CORES]: number }; +export type GarbageCollection = { [COUNT]: number, [TOTAL_SECS]: number }; +export type Memory = { [SYSTEM_TOTAL]: number, [PEAK_RSS_BYTES]: number }; +export type ResourceUsage = { [MEMORY]: Memory, [CPU]: Cpu, [GARBAGE_COLLECTION]: GarbageCollection }; +export type BuildOutput = { [ANALYSIS_RESULTS]: AnalysisResults, [GENERAL_INFO]: GeneralInfo, [IMAGE_DETAILS]: ImageDetails, [RESOURCE_USAGE]: ResourceUsage }; \ No newline at end of file diff --git a/src/definitions/dashboardNIDef.ts b/src/definitions/dashboardNIDef.ts new file mode 100644 index 0000000..75d9a45 --- /dev/null +++ b/src/definitions/dashboardNIDef.ts @@ -0,0 +1,15 @@ +export const HEAP_SIZE = "heap-size"; +export const CODE_SIZE = "code-size"; +export const HEAP_BREAKDOWN = "heap-breakdown"; +export const CODE_BREAKDOWN = "code-breakdown"; +export const COUNT = "count"; +export const NAME = "name"; +export const SIZE = "size"; +export const TOTAL = "total"; + +export type CodeSize = { [NAME]: string, [SIZE]: number }; +export type HeapSize = { [NAME]: string, [SIZE]: number, [COUNT]: number }; +export type DashboardDump = { + [CODE_BREAKDOWN]: { [CODE_SIZE]: CodeSize[], [TOTAL]?: number }, + [HEAP_BREAKDOWN]: { [HEAP_SIZE]: HeapSize[], [TOTAL]?: number } +}; \ No newline at end of file diff --git a/src/features.ts b/src/features.ts index 38ada00..470a338 100644 --- a/src/features.ts +++ b/src/features.ts @@ -1,8 +1,8 @@ import * as core from '@actions/core' import * as tc from '@actions/tool-cache' -import {IS_LINUX} from './constants' -import {exec} from './utils' -import {join} from 'path' +import { IS_LINUX } from './constants' +import { exec } from './utils' +import { join } from 'path' const MUSL_NAME = 'x86_64-linux-musl-native' const MUSL_VERSION = '10.2.1' @@ -42,11 +42,11 @@ export async function setUpNativeImageMusl(): Promise { zlibBuildOptions ) await exec('make', [], zlibBuildOptions) - await exec('make', ['install'], {cwd: zlibPath}) + await exec('make', ['install'], { cwd: zlibPath }) core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`) toolPath = await tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION) core.endGroup() } core.addPath(join(toolPath, 'bin')) -} +} \ No newline at end of file diff --git a/src/gu.ts b/src/gu.ts index e3c30cf..82a0564 100644 --- a/src/gu.ts +++ b/src/gu.ts @@ -1,6 +1,7 @@ -import {GRAALVM_PLATFORM} from './constants' -import {exec} from './utils' -import {join} from 'path' +import { GRAALVM_PLATFORM } from './constants' +import { exec } from './utils' +import { join } from 'path' +import { ExecOptions } from '@actions/exec' const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress'] const COMPONENT_TO_POST_INSTALL_HOOK = new Map>([ @@ -43,3 +44,17 @@ export async function setUpGUComponents( } } } + +export async function getVersionString(): Promise { + let output = ""; + const options: ExecOptions = { + listeners: { + stdout: (data: Buffer) => { + output += data.toString(); + } + } + }; + await exec('gu', ['--version'], options); + const versionParts = output.split(' '); + return versionParts[versionParts.length - 1]; +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 00b070d..cd50975 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,20 +1,22 @@ import * as c from './constants' import * as core from '@actions/core' import * as graalvm from './graalvm' -import {isFeatureAvailable as isCacheAvailable} from '@actions/cache' -import {join} from 'path' -import {restore} from './cache' -import {setUpDependencies} from './dependencies' -import {setUpGUComponents} from './gu' -import {setUpMandrel} from './mandrel' -import {setUpNativeImageMusl} from './features' -import {setUpWindowsEnvironment} from './msvc' +import { isFeatureAvailable as isCacheAvailable } from '@actions/cache' +import { join } from 'path' +import { restore } from './cache' +import { setUpDependencies } from './dependencies' +import { setUpGUComponents } from './gu' +import { setUpMandrel } from './mandrel' +import { setUpNativeImageMusl } from './features' +import { setUpWindowsEnvironment } from './msvc' +import { isNativeImageArtifactReport, isNativeImageBuildReport } from './options' +import { setUpNIArtifactReport, setUpNIBuildReport } from './reports' async function run(): Promise { try { - const graalvmVersion = core.getInput(c.INPUT_VERSION, {required: true}) + const graalvmVersion = core.getInput(c.INPUT_VERSION, { required: true }) const gdsToken = core.getInput(c.INPUT_GDS_TOKEN) - const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true}) + const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, { required: true }) const componentsString: string = core.getInput(c.INPUT_COMPONENTS) const components: string[] = componentsString.length > 0 ? componentsString.split(',') : [] @@ -25,6 +27,7 @@ async function run(): Promise { if (c.IS_WINDOWS) { setUpWindowsEnvironment() } + await setUpDependencies(components) if (enableNativeImageMusl) { await setUpNativeImageMusl() @@ -71,6 +74,18 @@ async function run(): Promise { } } + if (await isNativeImageArtifactReport()) { + await setUpNIArtifactReport() + } else if (core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT)) { + core.notice(`Artifact report isn't available for GraalVM version ${graalvmVersion}.`) + } + + if (await isNativeImageBuildReport()) { + await setUpNIBuildReport() + } else if (core.getBooleanInput(c.INPUT_NI_REPORT_BUILD)) { + core.notice(`Build report isn't available for GraalVM version ${graalvmVersion}.`) + } + if (cache && isCacheAvailable()) { await restore(cache) } diff --git a/src/options.ts b/src/options.ts new file mode 100644 index 0000000..3df45d5 --- /dev/null +++ b/src/options.ts @@ -0,0 +1,15 @@ +import * as core from "@actions/core"; +import * as c from './constants'; +import { getGVMversion } from "./utils"; + +export async function isNativeImageBuildReport(): Promise { + const version = await getGVMversion(); + const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); +} + +export async function isNativeImageArtifactReport(): Promise { + const version = await getGVMversion(); + const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); + return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); +} \ No newline at end of file diff --git a/src/reports.ts b/src/reports.ts new file mode 100644 index 0000000..f91755f --- /dev/null +++ b/src/reports.ts @@ -0,0 +1,123 @@ +import * as fs from "fs"; +import * as core from "@actions/core"; +import { SummaryTableRow } from "@actions/core/lib/summary"; +import { getGVMversion, setNativeImageOption } from "./utils"; +import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE } from "./definitions/dashboardNIDef"; +import { AnalysisResult, ANALYSIS_RESULTS, BuildOutput, BYTES, CODE_AREA, CPU, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES } from "./definitions/buildOutputDef"; + +export async function setUpNIArtifactReport(): Promise { + const version = await getGVMversion(); + await setNativeImageOption("-H:+DashboardCode"); + await setNativeImageOption("-H:+DashboardHeap"); + await setNativeImageOption("-H:-DashboardBgv"); + await setNativeImageOption("-H:+DashboardJson"); + await setNativeImageOption("-H:DashboardDump=artifactReport"); +} + +export async function setUpNIBuildReport(): Promise { + await setNativeImageOption("-H:BuildOutputJSONFile=outputReport.json"); +} + +export function createNIArtifactReport(): void { + const data: DashboardDump = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); + const heapBreakdown = data[HEAP_BREAKDOWN]; + const codeBreakdown = data[CODE_BREAKDOWN]; + let heap: HeapSize[] = heapBreakdown[HEAP_SIZE]; + let code: CodeSize[] = codeBreakdown[CODE_SIZE]; + heap.sort((v1, v2) => v2.size - v1.size); + heap = heap.slice(0, 10); + code = aggregateCode(code); + code.sort((v1, v2) => v2.size - v1.size); + code = code.slice(0, 10); + const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); + const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); + addMermaidPieSummary("Heap/Code size", true, + { name: "Heap size", value: heapSum }, + { name: "Code size", value: codeSum }); + addTableSummary("10 Top Heap sizes", + ["Name", "Count", "Size", "%"], + ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); + addTableSummary("10 Top Code sizes", + ["Name", "Size", "%"], + ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); +} + +export function createNIBuildReport(): void { + const data: BuildOutput = JSON.parse(fs.readFileSync("outputReport.json").toString()); + addTableSummary("Image details", + ["Type", "Bytes"], + ...imageDetailsToTableRows(data[IMAGE_DETAILS])); + addTableSummaryNoHeader("Resource usage", + ...resourceUsageToTableRows(data[RESOURCE_USAGE])); + addTableSummary("Analysis Results", + ["Type", "Total", "Reflection", "JNI", "Reachable"], + ...Object.entries(data[ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); +} + +function analysisResultEntryToTableRow(entry: [string, AnalysisResult]): SummaryTableRow { + return [entry[0], + `${entry[1].total }`, + `${entry[1].reflection }`, + `${entry[1].jni}`, + `${entry[1].reachable}`]; +} + +function imageDetailsToTableRows(imageDetails: ImageDetails): SummaryTableRow[] { + const out: SummaryTableRow[] = []; + const imageHeap: ImageHeap = imageDetails[IMAGE_HEAP]; + out.push(["Heap", `${imageHeap[BYTES]}`]); + out.push(["Resources", `${imageHeap[RESOURCES][BYTES]}`]); + out.push(["Code", `${imageDetails[CODE_AREA][BYTES]}`]); + out.push(["Total", `${imageDetails[TOTAL_BYTES]}`]); + return out; +} +function resourceUsageToTableRows(resourceUsage: ResourceUsage): SummaryTableRow[] { + const out: SummaryTableRow[] = []; + out.push(["Memory usage", resourceUsage[MEMORY][SYSTEM_TOTAL] + " B"]); + out.push(["CPU usage", (resourceUsage[CPU][LOAD] / resourceUsage[CPU][TOTAL_CORES]).toFixed(2) + "%"]); + return out; +} + +function aggregateCode(code: CodeSize[]): CodeSize[] { + const aggregates: Map = new Map(); + code.forEach(element => { + const pkg = parsePkg(element.name); + aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); + }); + code = []; + aggregates.forEach((s, n) => code.push({ name: n, size: s })); + return code; +} + +function parsePkg(name: string): string { + const parts: string[] = name.split('.'); + let pkg: string[] = []; + for (const part of parts) { + if (part === part.toLowerCase()) { + pkg.push(part); + } else + break; + } + return pkg.join('.'); +} + +function addMermaidPieSummary(title: string, showData: boolean, ...data: { name: string, value: number }[]) { + //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n + core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); +} + +function addTableSummary(title: string, colNames: string[], ...data: SummaryTableRow[]) { + const rows: SummaryTableRow[] = []; + rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); + rows.push(colNames.map(name => { return { data: name, header: true } })); + core.summary.addTable(rows.concat(data)); +} +function addTableSummaryNoHeader(title: string, ...data: SummaryTableRow[]) { + const rows: SummaryTableRow[] = []; + let max = 0; + for (const row of data) { + max = Math.max(row.length, max); + } + rows.push([{ data: title, header: true, colspan: `${max}` }]); + core.summary.addTable(rows.concat(data)); +} \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts index 0ded275..3e200c0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,12 +1,14 @@ import * as c from './constants' +import { getVersionString } from './gu'; import * as core from '@actions/core' import * as httpClient from '@actions/http-client' import * as tc from '@actions/tool-cache' -import {ExecOptions, exec as e} from '@actions/exec' -import {readFileSync, readdirSync} from 'fs' -import {Octokit} from '@octokit/core' -import {createHash} from 'crypto' -import {join} from 'path' +import { ExecOptions, exec as e } from '@actions/exec' +import { readFileSync, readdirSync } from 'fs' +import { Octokit } from '@octokit/core' +import { createHash } from 'crypto' +import { join } from 'path' +import * as fs from 'fs' // Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com' @@ -36,7 +38,7 @@ export async function getLatestRelease( repo: string ): Promise { const githubToken = core.getInput('github-token') - const options = githubToken.length > 0 ? {auth: githubToken} : {} + const options = githubToken.length > 0 ? { auth: githubToken } : {} const octokit = new GitHub(options) return ( await octokit.request('GET /repos/{owner}/{repo}/releases/latest', { @@ -112,3 +114,33 @@ function toSemVer(version: string): string { const patch = parts.length > 2 ? parts.slice(2).join('-') : '0' return `${major}.${minor}.${patch}` } + +function getNativeImageOptionsFile(): string { + let optionsFile: string | undefined = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + if (optionsFile === undefined) + core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + return optionsFile; +} + +export async function setNativeImageOption(value: string): Promise { + let optionsFile: string = getNativeImageOptionsFile(); + if (fs.existsSync(optionsFile)) { + fs.appendFileSync(optionsFile, " " + value); + } else { + fs.writeFileSync(optionsFile, "NativeImageArgs = " + value); + } +} + +type Version = { major: number, minor: number, patch: number, hotfix: number, dev: boolean } +export async function getGVMversion(): Promise { + const versionString = await getVersionString(); + const devParts = versionString.split('-'); + const versionParts = devParts[0].split('.'); + return { + major: parseInt(versionParts[0]) || 0, + minor: parseInt(versionParts[1]) || 0, + patch: parseInt(versionParts[2]) || 0, + hotfix: parseInt(versionParts[3]) || 0, + dev: devParts[1] === 'dev' + }; +} \ No newline at end of file From f9f532d0f92da873957ef17914c813c86cbd9363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Fri, 7 Oct 2022 11:18:24 +0200 Subject: [PATCH 2/9] Tests for NI report feature. --- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51d0908..5dcdba8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -175,6 +175,44 @@ jobs: javac HelloWorld.java native-image --static --libc=musl HelloWorld ./helloworld + test-native-image-report-artifact: + name: native-image-artifact-report on ubuntu-latest + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run setup-graalvm action + uses: ./ + with: + version: 'latest' + java-version: '17' + components: 'native-image' + native-image-report-artifact: 'true' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build static HelloWorld executable with GraalVM Native Image and make artifact report + run: | + echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java + javac HelloWorld.java + native-image --static HelloWorld + ./helloworld + test-native-image-report-build: + name: native-image-artifact-report on ubuntu-latest + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run setup-graalvm action + uses: ./ + with: + version: 'dev' # report output option wasn't released yet + java-version: '17' + components: 'native-image' + native-image-report-build: 'true' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build static HelloWorld executable with GraalVM Native Image and make build report + run: | + echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java + javac HelloWorld.java + native-image --static HelloWorld + ./helloworld test-extensive: name: extensive tests on ubuntu-latest runs-on: ubuntu-latest From 2ecc29e032d95c8965726679481b806d54d2f523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Fri, 7 Oct 2022 11:39:03 +0200 Subject: [PATCH 3/9] Include Report tests in Musl test. --- .github/workflows/test.yml | 42 +++----------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5dcdba8..ed62b1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -164,54 +164,18 @@ jobs: - name: Run setup-graalvm action uses: ./ with: - version: 'latest' + version: 'dev' # report output option wasn't released yet java-version: '17' components: 'native-image' native-image-musl: 'true' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Build static HelloWorld executable with GraalVM Native Image and musl - run: | - echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java - javac HelloWorld.java - native-image --static --libc=musl HelloWorld - ./helloworld - test-native-image-report-artifact: - name: native-image-artifact-report on ubuntu-latest - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run setup-graalvm action - uses: ./ - with: - version: 'latest' - java-version: '17' - components: 'native-image' native-image-report-artifact: 'true' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Build static HelloWorld executable with GraalVM Native Image and make artifact report - run: | - echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java - javac HelloWorld.java - native-image --static HelloWorld - ./helloworld - test-native-image-report-build: - name: native-image-artifact-report on ubuntu-latest - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run setup-graalvm action - uses: ./ - with: - version: 'dev' # report output option wasn't released yet - java-version: '17' - components: 'native-image' native-image-report-build: 'true' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Build static HelloWorld executable with GraalVM Native Image and make build report + - name: Build static HelloWorld executable with GraalVM Native Image and musl run: | echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java javac HelloWorld.java - native-image --static HelloWorld + native-image --static --libc=musl HelloWorld ./helloworld test-extensive: name: extensive tests on ubuntu-latest From 64d066d7592cd4b36fd0189e6885d60fcb970c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Fri, 14 Oct 2022 16:34:48 +0200 Subject: [PATCH 4/9] Build markdown + improved Code sizes report. --- src/markdown.ts | 73 +++++++++++++++++++++ src/reports.ts | 167 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 188 insertions(+), 52 deletions(-) create mode 100644 src/markdown.ts diff --git a/src/markdown.ts b/src/markdown.ts new file mode 100644 index 0000000..296ba79 --- /dev/null +++ b/src/markdown.ts @@ -0,0 +1,73 @@ +function open(tag: string): string { + return '<' + tag + '>'; +} +function close(tag: string): string { + return open('/' + tag); +} +function app(...content: string[]): string { + return content.join('\n'); +} +function enclose(tag: string, content: string, attr?: string) { + return app( + open(tag + (attr ? ' ' + attr : '')), + content, + close(tag)); +} + +const DETAILS = 'details'; +const OPEN_ATTR = 'open'; +const SUMMARY = 'summary'; +export function detail(summary: string, details: string, closed: boolean = true): string { + return enclose(DETAILS, app( + enclose(SUMMARY, + summary, + closed ? undefined : OPEN_ATTR) + , details)); +} + +const TABLE = 'table'; +const TR = 'tr'; +const TH = 'th'; +const TD = 'td'; +const COLSPAN_ATTR = 'colspan='; +export type TableCell = { content: string, header?: boolean, span?: number }; +export type TableRow = (TableCell | string)[]; +function mark_cell(content: string, header: boolean = false, span?: number): string { + return enclose(header ? TH : TD, + content, + span ? COLSPAN_ATTR + span : undefined); +} +function cell(cell: TableCell | string): string { + if (typeof cell === 'string') + return mark_cell(cell); + return mark_cell(cell.content, cell.header, cell.span); +} +function row(row: TableRow) { + return enclose(TR, row.map(cell).join('\n')); +} +export function makeHeaderRow(...names: string[]): TableRow { + return names.map(n => { return { content: n, header: true } }); +} +export function table(table: TableRow[]): string { + return enclose(TABLE, table.map(row).join('\n')); +} + +const CODE = "code"; +const PRE = "pre"; +const LANG_ATTR = "lang=" +export enum LANG { + MERMAID = "mermaid", +} +export function code(lang: LANG, code: string): string { + return enclose(PRE, enclose(CODE, code), LANG_ATTR + lang); +} + +export type MermaidPieData = { name: string, size: number }; +export function mermaidPie(title: string, showData: boolean, ...data: MermaidPieData[]): string { + return code(LANG.MERMAID, `pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.size).join("\n\t")}`); +} + +const BOLD = "b"; +export function bold(input: string): string { + return enclose(BOLD, input); +} \ No newline at end of file diff --git a/src/reports.ts b/src/reports.ts index f91755f..22a6282 100644 --- a/src/reports.ts +++ b/src/reports.ts @@ -1,8 +1,8 @@ import * as fs from "fs"; import * as core from "@actions/core"; -import { SummaryTableRow } from "@actions/core/lib/summary"; +import * as mark from "./markdown"; import { getGVMversion, setNativeImageOption } from "./utils"; -import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE } from "./definitions/dashboardNIDef"; +import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE, NAME, SIZE } from "./definitions/dashboardNIDef"; import { AnalysisResult, ANALYSIS_RESULTS, BuildOutput, BYTES, CODE_AREA, CPU, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES } from "./definitions/buildOutputDef"; export async function setUpNIArtifactReport(): Promise { @@ -18,28 +18,63 @@ export async function setUpNIBuildReport(): Promise { await setNativeImageOption("-H:BuildOutputJSONFile=outputReport.json"); } +type Sized = { size: number }; +const descend = (v1: Sized, v2: Sized) => v2.size - v1.size; +const sum = (n1: number, n2: number) => n1 + n2; + export function createNIArtifactReport(): void { const data: DashboardDump = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[HEAP_BREAKDOWN]; const codeBreakdown = data[CODE_BREAKDOWN]; let heap: HeapSize[] = heapBreakdown[HEAP_SIZE]; let code: CodeSize[] = codeBreakdown[CODE_SIZE]; - heap.sort((v1, v2) => v2.size - v1.size); + const heapSum = heap.map(v => v.size).reduce(sum); + const codeSum = code.map(v => v.size).reduce(sum); + heap.sort(descend); heap = heap.slice(0, 10); - code = aggregateCode(code); - code.sort((v1, v2) => v2.size - v1.size); - code = code.slice(0, 10); - const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); - const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); + let pCode: Package[] = parsePackages(code); addMermaidPieSummary("Heap/Code size", true, - { name: "Heap size", value: heapSum }, - { name: "Code size", value: codeSum }); + { name: "Heap size", size: heapSum }, + { name: "Code size", size: codeSum }); addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("10 Top Code sizes", - ["Name", "Size", "%"], - ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); + addTableSummary("Code sizes by packages", + ["Name", "Size"], + ...pCode.sort(descend).map(c => [processPackage(c), `${c.size}`])); +} + +function processPackage(pkg: Package): string { + return mark.detail(mark.bold(pkg[NAME]), packageToTables(pkg)); +} + +function packageToTables(pkg: Package): string { + let out = ""; + if (pkg.pkg !== undefined && pkg.pkg.size > 0) { + out += packageToTable([...pkg.pkg.values()]); + } + if (pkg.codes !== undefined) { + if (pkg.pkg !== undefined && pkg.pkg.size > 0) { + out += '\n' + out += mark.detail(`${mark.bold('"methods"')} size: ${getSizeDiff(pkg)}`, codeSizesToTable(pkg.codes)); + } else { + out += codeSizesToTable(pkg.codes); + } + } + return out; +} + +function packageToTable(pkgs: Package[]): string { + const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; + return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), `${cd[SIZE]}`]))); +} +function codeSizesToTable(codes: CodeSize[]): string { + const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; + return mark.table(rows.concat(codes.sort(descend).map(cd => [cd[NAME], `${cd[SIZE]}`]))); +} + +function getSizeDiff(pkg: Package): number { + return pkg[SIZE] - [...pkg.pkg.values()].map(p => p[SIZE]).reduce(sum); } export function createNIBuildReport(): void { @@ -54,16 +89,16 @@ export function createNIBuildReport(): void { ...Object.entries(data[ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); } -function analysisResultEntryToTableRow(entry: [string, AnalysisResult]): SummaryTableRow { +function analysisResultEntryToTableRow(entry: [string, AnalysisResult]): mark.TableRow { return [entry[0], - `${entry[1].total }`, - `${entry[1].reflection }`, + `${entry[1].total}`, + `${entry[1].reflection}`, `${entry[1].jni}`, `${entry[1].reachable}`]; } -function imageDetailsToTableRows(imageDetails: ImageDetails): SummaryTableRow[] { - const out: SummaryTableRow[] = []; +function imageDetailsToTableRows(imageDetails: ImageDetails): mark.TableRow[] { + const out: mark.TableRow[] = []; const imageHeap: ImageHeap = imageDetails[IMAGE_HEAP]; out.push(["Heap", `${imageHeap[BYTES]}`]); out.push(["Resources", `${imageHeap[RESOURCES][BYTES]}`]); @@ -71,53 +106,81 @@ function imageDetailsToTableRows(imageDetails: ImageDetails): SummaryTableRow[] out.push(["Total", `${imageDetails[TOTAL_BYTES]}`]); return out; } -function resourceUsageToTableRows(resourceUsage: ResourceUsage): SummaryTableRow[] { - const out: SummaryTableRow[] = []; +function resourceUsageToTableRows(resourceUsage: ResourceUsage): mark.TableRow[] { + const out: mark.TableRow[] = []; out.push(["Memory usage", resourceUsage[MEMORY][SYSTEM_TOTAL] + " B"]); - out.push(["CPU usage", (resourceUsage[CPU][LOAD] / resourceUsage[CPU][TOTAL_CORES]).toFixed(2) + "%"]); + out.push(["CPU usage", (resourceUsage[CPU][LOAD] / resourceUsage[CPU][TOTAL_CORES] * 100).toFixed(2) + "%"]); return out; } -function aggregateCode(code: CodeSize[]): CodeSize[] { - const aggregates: Map = new Map(); - code.forEach(element => { - const pkg = parsePkg(element.name); - aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); +type Package = CodeSize & { pkg: Map, codes?: CodeSize[] }; +function parsePackages(code: CodeSize[]): Package[] { + const pkgs: Map = new Map(); + code.forEach(c => { + const parts = c[NAME].split('.'); + let prt = 0; + let p: Package = { name: "", size: 0, pkg: new Map() }; + let m: Map = pkgs; + for (const part of parts) { + if (part === part.toLowerCase()) { + p = appMap(part, c[SIZE], m); + m = p.pkg; + prt += part.length + 1; + } else { + break; + } + } + if (p.codes === undefined) + p.codes = []; + c[NAME] = c[NAME].slice(prt); + p.codes.push(c); }); - code = []; - aggregates.forEach((s, n) => code.push({ name: n, size: s })); - return code; -} - -function parsePkg(name: string): string { - const parts: string[] = name.split('.'); - let pkg: string[] = []; - for (const part of parts) { - if (part === part.toLowerCase()) { - pkg.push(part); - } else - break; + return mergePackages([...pkgs.values()]); +} + +function mergePackages(pkgs: Package[]): Package[] { + pkgs.forEach(mergePackage); + return pkgs; +} + +function mergePackage(pkg: Package): Package { + if (pkg.pkg.size === 1 && pkg.codes === undefined) { + const pack = pkg.pkg.get(pkg.pkg.keys().next().value) as Package; + pkg[NAME] = pkg[NAME] + "." + pack[NAME]; + pkg.pkg = pack.pkg; + pkg.codes = pack.codes; + mergePackage(pkg); + } else + mergePackages([...pkg.pkg.values()]); + return pkg; +} + +function appMap(part: string, size: number, map: Map): Package { + let next: Package | undefined = map.get(part); + if (next === undefined) { + next = { name: part, size: 0, pkg: new Map() }; + map.set(part, next); } - return pkg.join('.'); + next.size += size; + return next; } -function addMermaidPieSummary(title: string, showData: boolean, ...data: { name: string, value: number }[]) { - //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n - core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); +function addMermaidPieSummary(title: string, showData: boolean, ...data: mark.MermaidPieData[]) { + core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); } -function addTableSummary(title: string, colNames: string[], ...data: SummaryTableRow[]) { - const rows: SummaryTableRow[] = []; - rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); - rows.push(colNames.map(name => { return { data: name, header: true } })); - core.summary.addTable(rows.concat(data)); +function addTableSummary(title: string, colNames: string[], ...data: mark.TableRow[]) { + const rows: mark.TableRow[] = []; + rows.push([{ content: title, header: true, span: colNames.length }]); + rows.push(mark.makeHeaderRow(...colNames)); + core.summary.addRaw(mark.table(rows.concat(data))); } -function addTableSummaryNoHeader(title: string, ...data: SummaryTableRow[]) { - const rows: SummaryTableRow[] = []; +function addTableSummaryNoHeader(title: string, ...data: mark.TableRow[]) { + const rows: mark.TableRow[] = []; let max = 0; for (const row of data) { max = Math.max(row.length, max); } - rows.push([{ data: title, header: true, colspan: `${max}` }]); - core.summary.addTable(rows.concat(data)); + rows.push([{ content: title, header: true, span: max }]); + core.summary.addRaw(mark.table(rows.concat(data))); } \ No newline at end of file From 76e15251970d261df05b55221dbb751b28ff9513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Mon, 24 Oct 2022 16:03:47 +0200 Subject: [PATCH 5/9] Translate bytes to human readable form. --- src/reports.ts | 33 +++++++++++++++++---------------- src/utils.ts | 9 +++++++++ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/reports.ts b/src/reports.ts index 22a6282..d3c2a27 100644 --- a/src/reports.ts +++ b/src/reports.ts @@ -1,9 +1,10 @@ import * as fs from "fs"; import * as core from "@actions/core"; import * as mark from "./markdown"; -import { getGVMversion, setNativeImageOption } from "./utils"; +import { getGVMversion, hRBytes, setNativeImageOption } from "./utils"; import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE, NAME, SIZE } from "./definitions/dashboardNIDef"; import { AnalysisResult, ANALYSIS_RESULTS, BuildOutput, BYTES, CODE_AREA, CPU, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES } from "./definitions/buildOutputDef"; +import * as art from "@actions/artifact" export async function setUpNIArtifactReport(): Promise { const version = await getGVMversion(); @@ -38,10 +39,10 @@ export function createNIArtifactReport(): void { { name: "Code size", size: codeSum }); addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], - ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); + ...heap.map(h => [h.name, `${h.count}`, hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); addTableSummary("Code sizes by packages", ["Name", "Size"], - ...pCode.sort(descend).map(c => [processPackage(c), `${c.size}`])); + ...pCode.sort(descend).map(c => [processPackage(c), hRBytes(c.size)])); } function processPackage(pkg: Package): string { @@ -56,7 +57,7 @@ function packageToTables(pkg: Package): string { if (pkg.codes !== undefined) { if (pkg.pkg !== undefined && pkg.pkg.size > 0) { out += '\n' - out += mark.detail(`${mark.bold('"methods"')} size: ${getSizeDiff(pkg)}`, codeSizesToTable(pkg.codes)); + out += mark.detail(`${mark.bold('"methods"')} size: ${hRBytes(getSizeDiff(pkg))}`, codeSizesToTable(pkg.codes)); } else { out += codeSizesToTable(pkg.codes); } @@ -66,11 +67,11 @@ function packageToTables(pkg: Package): string { function packageToTable(pkgs: Package[]): string { const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; - return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), `${cd[SIZE]}`]))); + return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), hRBytes(cd[SIZE])]))); } function codeSizesToTable(codes: CodeSize[]): string { const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; - return mark.table(rows.concat(codes.sort(descend).map(cd => [cd[NAME], `${cd[SIZE]}`]))); + return mark.table(rows.concat(codes.sort(descend).map(cd => [cd[NAME], hRBytes(cd[SIZE])]))); } function getSizeDiff(pkg: Package): number { @@ -91,24 +92,24 @@ export function createNIBuildReport(): void { function analysisResultEntryToTableRow(entry: [string, AnalysisResult]): mark.TableRow { return [entry[0], - `${entry[1].total}`, - `${entry[1].reflection}`, - `${entry[1].jni}`, - `${entry[1].reachable}`]; + hRBytes(entry[1].total), + hRBytes(entry[1].reflection), + hRBytes(entry[1].jni), + hRBytes(entry[1].reachable)]; } function imageDetailsToTableRows(imageDetails: ImageDetails): mark.TableRow[] { const out: mark.TableRow[] = []; const imageHeap: ImageHeap = imageDetails[IMAGE_HEAP]; - out.push(["Heap", `${imageHeap[BYTES]}`]); - out.push(["Resources", `${imageHeap[RESOURCES][BYTES]}`]); - out.push(["Code", `${imageDetails[CODE_AREA][BYTES]}`]); - out.push(["Total", `${imageDetails[TOTAL_BYTES]}`]); + out.push(["Heap", hRBytes(imageHeap[BYTES])]); + out.push(["Resources", hRBytes(imageHeap[RESOURCES][BYTES])]); + out.push(["Code", hRBytes(imageDetails[CODE_AREA][BYTES])]); + out.push(["Total", hRBytes(imageDetails[TOTAL_BYTES])]); return out; } function resourceUsageToTableRows(resourceUsage: ResourceUsage): mark.TableRow[] { const out: mark.TableRow[] = []; - out.push(["Memory usage", resourceUsage[MEMORY][SYSTEM_TOTAL] + " B"]); + out.push(["Memory usage", hRBytes(resourceUsage[MEMORY][SYSTEM_TOTAL])]); out.push(["CPU usage", (resourceUsage[CPU][LOAD] / resourceUsage[CPU][TOTAL_CORES] * 100).toFixed(2) + "%"]); return out; } @@ -172,7 +173,7 @@ function addMermaidPieSummary(title: string, showData: boolean, ...data: mark.Me function addTableSummary(title: string, colNames: string[], ...data: mark.TableRow[]) { const rows: mark.TableRow[] = []; rows.push([{ content: title, header: true, span: colNames.length }]); - rows.push(mark.makeHeaderRow(...colNames)); + rows.push(colNames.map(name => { return { content: name, header: true } })); core.summary.addRaw(mark.table(rows.concat(data))); } function addTableSummaryNoHeader(title: string, ...data: mark.TableRow[]) { diff --git a/src/utils.ts b/src/utils.ts index 3e200c0..6e7b99b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -143,4 +143,13 @@ export async function getGVMversion(): Promise { hotfix: parseInt(versionParts[3]) || 0, dev: devParts[1] === 'dev' }; +} + +const sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; +const k = Math.pow(2, 10); +export function hRBytes(bytes: number, decimals = 2): string { + if (bytes <= 0) return '0 Bytes'; + const dm = decimals < 0 ? 0 : decimals; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } \ No newline at end of file From 0a4ed20d035533f8d8d12fd546a3b86835d48c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Mon, 24 Oct 2022 18:25:21 +0200 Subject: [PATCH 6/9] Keep just package sizes to shring summary size. --- src/reports.ts | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/src/reports.ts b/src/reports.ts index d3c2a27..b058ede 100644 --- a/src/reports.ts +++ b/src/reports.ts @@ -4,7 +4,6 @@ import * as mark from "./markdown"; import { getGVMversion, hRBytes, setNativeImageOption } from "./utils"; import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE, NAME, SIZE } from "./definitions/dashboardNIDef"; import { AnalysisResult, ANALYSIS_RESULTS, BuildOutput, BYTES, CODE_AREA, CPU, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES } from "./definitions/buildOutputDef"; -import * as art from "@actions/artifact" export async function setUpNIArtifactReport(): Promise { const version = await getGVMversion(); @@ -46,37 +45,20 @@ export function createNIArtifactReport(): void { } function processPackage(pkg: Package): string { - return mark.detail(mark.bold(pkg[NAME]), packageToTables(pkg)); + const boldName = mark.bold(pkg[NAME]); + if (pkg.pkg.size > 0) + return mark.detail(boldName, packageToTable(pkg)); + return boldName; } -function packageToTables(pkg: Package): string { - let out = ""; - if (pkg.pkg !== undefined && pkg.pkg.size > 0) { - out += packageToTable([...pkg.pkg.values()]); - } - if (pkg.codes !== undefined) { - if (pkg.pkg !== undefined && pkg.pkg.size > 0) { - out += '\n' - out += mark.detail(`${mark.bold('"methods"')} size: ${hRBytes(getSizeDiff(pkg))}`, codeSizesToTable(pkg.codes)); - } else { - out += codeSizesToTable(pkg.codes); - } - } - return out; +function packageToTable(pkg: Package): string { + return packagesToTable([...pkg.pkg.values()]); } -function packageToTable(pkgs: Package[]): string { +function packagesToTable(pkgs: Package[]): string { const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), hRBytes(cd[SIZE])]))); } -function codeSizesToTable(codes: CodeSize[]): string { - const rows: mark.TableRow[] = [mark.makeHeaderRow("Name", "Size")]; - return mark.table(rows.concat(codes.sort(descend).map(cd => [cd[NAME], hRBytes(cd[SIZE])]))); -} - -function getSizeDiff(pkg: Package): number { - return pkg[SIZE] - [...pkg.pkg.values()].map(p => p[SIZE]).reduce(sum); -} export function createNIBuildReport(): void { const data: BuildOutput = JSON.parse(fs.readFileSync("outputReport.json").toString()); @@ -114,7 +96,7 @@ function resourceUsageToTableRows(resourceUsage: ResourceUsage): mark.TableRow[] return out; } -type Package = CodeSize & { pkg: Map, codes?: CodeSize[] }; +type Package = CodeSize & { pkg: Map }; function parsePackages(code: CodeSize[]): Package[] { const pkgs: Map = new Map(); code.forEach(c => { @@ -131,10 +113,6 @@ function parsePackages(code: CodeSize[]): Package[] { break; } } - if (p.codes === undefined) - p.codes = []; - c[NAME] = c[NAME].slice(prt); - p.codes.push(c); }); return mergePackages([...pkgs.values()]); } @@ -145,11 +123,10 @@ function mergePackages(pkgs: Package[]): Package[] { } function mergePackage(pkg: Package): Package { - if (pkg.pkg.size === 1 && pkg.codes === undefined) { + if (pkg.pkg.size === 1) { const pack = pkg.pkg.get(pkg.pkg.keys().next().value) as Package; pkg[NAME] = pkg[NAME] + "." + pack[NAME]; pkg.pkg = pack.pkg; - pkg.codes = pack.codes; mergePackage(pkg); } else mergePackages([...pkg.pkg.values()]); From 66b070dc1cf2babad69311c9d8f4617bfefab39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Mon, 31 Oct 2022 12:14:39 +0100 Subject: [PATCH 7/9] Built the action. --- dist/cleanup/index.js | 211 +++++++++++++++++++++++++++++++++--------- dist/main/index.js | 211 +++++++++++++++++++++++++++++++++--------- 2 files changed, 330 insertions(+), 92 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index e92a36d..9690140 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -67231,6 +67231,80 @@ function getVersionString() { exports.getVersionString = getVersionString; +/***/ }), + +/***/ 4270: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.makeHeaderRow = exports.detail = void 0; +function open(tag) { + return '<' + tag + '>'; +} +function close(tag) { + return open('/' + tag); +} +function app(...content) { + return content.join('\n'); +} +function enclose(tag, content, attr) { + return app(open(tag + (attr ? ' ' + attr : '')), content, close(tag)); +} +const DETAILS = 'details'; +const OPEN_ATTR = 'open'; +const SUMMARY = 'summary'; +function detail(summary, details, closed = true) { + return enclose(DETAILS, app(enclose(SUMMARY, summary, closed ? undefined : OPEN_ATTR), details)); +} +exports.detail = detail; +const TABLE = 'table'; +const TR = 'tr'; +const TH = 'th'; +const TD = 'td'; +const COLSPAN_ATTR = 'colspan='; +function mark_cell(content, header = false, span) { + return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined); +} +function cell(cell) { + if (typeof cell === 'string') + return mark_cell(cell); + return mark_cell(cell.content, cell.header, cell.span); +} +function row(row) { + return enclose(TR, row.map(cell).join('\n')); +} +function makeHeaderRow(...names) { + return names.map(n => { return { content: n, header: true }; }); +} +exports.makeHeaderRow = makeHeaderRow; +function table(table) { + return enclose(TABLE, table.map(row).join('\n')); +} +exports.table = table; +const CODE = "code"; +const PRE = "pre"; +const LANG_ATTR = "lang="; +var LANG; +(function (LANG) { + LANG["MERMAID"] = "mermaid"; +})(LANG = exports.LANG || (exports.LANG = {})); +function code(lang, code) { + return enclose(PRE, enclose(CODE, code), LANG_ATTR + lang); +} +exports.code = code; +function mermaidPie(title, showData, ...data) { + return code(LANG.MERMAID, `pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.size).join("\n\t")}`); +} +exports.mermaidPie = mermaidPie; +const BOLD = "b"; +function bold(input) { + return enclose(BOLD, input); +} +exports.bold = bold; + + /***/ }), /***/ 6159: @@ -67328,6 +67402,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); +const mark = __importStar(__nccwpck_require__(4270)); const utils_1 = __nccwpck_require__(1314); const dashboardNIDef_1 = __nccwpck_require__(6014); const buildOutputDef_1 = __nccwpck_require__(1833); @@ -67348,24 +67423,37 @@ function setUpNIBuildReport() { }); } exports.setUpNIBuildReport = setUpNIBuildReport; +const descend = (v1, v2) => v2.size - v1.size; +const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; let heap = heapBreakdown[dashboardNIDef_1.HEAP_SIZE]; let code = codeBreakdown[dashboardNIDef_1.CODE_SIZE]; - heap.sort((v1, v2) => v2.size - v1.size); + const heapSum = heap.map(v => v.size).reduce(sum); + const codeSum = code.map(v => v.size).reduce(sum); + heap.sort(descend); heap = heap.slice(0, 10); - code = aggregateCode(code); - code.sort((v1, v2) => v2.size - v1.size); - code = code.slice(0, 10); - const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); - const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); - addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", value: heapSum }, { name: "Code size", value: codeSum }); - addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("10 Top Code sizes", ["Name", "Size", "%"], ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); + let pCode = parsePackages(code); + addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); + addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); + addTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); } exports.createNIArtifactReport = createNIArtifactReport; +function processPackage(pkg) { + const boldName = mark.bold(pkg[dashboardNIDef_1.NAME]); + if (pkg.pkg.size > 0) + return mark.detail(boldName, packageToTable(pkg)); + return boldName; +} +function packageToTable(pkg) { + return packagesToTable([...pkg.pkg.values()]); +} +function packagesToTable(pkgs) { + const rows = [mark.makeHeaderRow("Name", "Size")]; + return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), utils_1.hRBytes(cd[dashboardNIDef_1.SIZE])]))); +} function createNIBuildReport() { const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); @@ -67375,57 +67463,78 @@ function createNIBuildReport() { exports.createNIBuildReport = createNIBuildReport; function analysisResultEntryToTableRow(entry) { return [entry[0], - `${entry[1].total}`, - `${entry[1].reflection}`, - `${entry[1].jni}`, - `${entry[1].reachable}`]; + utils_1.hRBytes(entry[1].total), + utils_1.hRBytes(entry[1].reflection), + utils_1.hRBytes(entry[1].jni), + utils_1.hRBytes(entry[1].reachable)]; } function imageDetailsToTableRows(imageDetails) { const out = []; const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; - out.push(["Heap", `${imageHeap[buildOutputDef_1.BYTES]}`]); - out.push(["Resources", `${imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES]}`]); - out.push(["Code", `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]}`]); - out.push(["Total", `${imageDetails[buildOutputDef_1.TOTAL_BYTES]}`]); + out.push(["Heap", utils_1.hRBytes(imageHeap[buildOutputDef_1.BYTES])]); + out.push(["Resources", utils_1.hRBytes(imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES])]); + out.push(["Code", utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES])]); + out.push(["Total", utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES])]); return out; } function resourceUsageToTableRows(resourceUsage) { const out = []; - out.push(["Memory usage", resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL] + " B"]); - out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES]).toFixed(2) + "%"]); + out.push(["Memory usage", utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL])]); + out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES] * 100).toFixed(2) + "%"]); return out; } -function aggregateCode(code) { - const aggregates = new Map(); - code.forEach(element => { - const pkg = parsePkg(element.name); - aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); +function parsePackages(code) { + const pkgs = new Map(); + code.forEach(c => { + const parts = c[dashboardNIDef_1.NAME].split('.'); + let prt = 0; + let p = { name: "", size: 0, pkg: new Map() }; + let m = pkgs; + for (const part of parts) { + if (part === part.toLowerCase()) { + p = appMap(part, c[dashboardNIDef_1.SIZE], m); + m = p.pkg; + prt += part.length + 1; + } + else { + break; + } + } }); - code = []; - aggregates.forEach((s, n) => code.push({ name: n, size: s })); - return code; -} -function parsePkg(name) { - const parts = name.split('.'); - let pkg = []; - for (const part of parts) { - if (part === part.toLowerCase()) { - pkg.push(part); - } - else - break; + return mergePackages([...pkgs.values()]); +} +function mergePackages(pkgs) { + pkgs.forEach(mergePackage); + return pkgs; +} +function mergePackage(pkg) { + if (pkg.pkg.size === 1) { + const pack = pkg.pkg.get(pkg.pkg.keys().next().value); + pkg[dashboardNIDef_1.NAME] = pkg[dashboardNIDef_1.NAME] + "." + pack[dashboardNIDef_1.NAME]; + pkg.pkg = pack.pkg; + mergePackage(pkg); + } + else + mergePackages([...pkg.pkg.values()]); + return pkg; +} +function appMap(part, size, map) { + let next = map.get(part); + if (next === undefined) { + next = { name: part, size: 0, pkg: new Map() }; + map.set(part, next); } - return pkg.join('.'); + next.size += size; + return next; } function addMermaidPieSummary(title, showData, ...data) { - //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n - core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); + core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); } function addTableSummary(title, colNames, ...data) { const rows = []; - rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); - rows.push(colNames.map(name => { return { data: name, header: true }; })); - core.summary.addTable(rows.concat(data)); + rows.push([{ content: title, header: true, span: colNames.length }]); + rows.push(colNames.map(name => { return { content: name, header: true }; })); + core.summary.addRaw(mark.table(rows.concat(data))); } function addTableSummaryNoHeader(title, ...data) { const rows = []; @@ -67433,8 +67542,8 @@ function addTableSummaryNoHeader(title, ...data) { for (const row of data) { max = Math.max(row.length, max); } - rows.push([{ data: title, header: true, colspan: `${max}` }]); - core.summary.addTable(rows.concat(data)); + rows.push([{ content: title, header: true, span: max }]); + core.summary.addRaw(mark.table(rows.concat(data))); } @@ -67474,7 +67583,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; const c = __importStar(__nccwpck_require__(9042)); const gu_1 = __nccwpck_require__(5609); const core = __importStar(__nccwpck_require__(2186)); @@ -67612,6 +67721,16 @@ function getGVMversion() { }); } exports.getGVMversion = getGVMversion; +const sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; +const k = Math.pow(2, 10); +function hRBytes(bytes, decimals = 2) { + if (bytes <= 0) + return '0 Bytes'; + const dm = decimals < 0 ? 0 : decimals; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} +exports.hRBytes = hRBytes; /***/ }), diff --git a/dist/main/index.js b/dist/main/index.js index ef64d9e..ef0d1f0 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -67767,6 +67767,80 @@ function determineToolName(javaVersion) { } +/***/ }), + +/***/ 4270: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.makeHeaderRow = exports.detail = void 0; +function open(tag) { + return '<' + tag + '>'; +} +function close(tag) { + return open('/' + tag); +} +function app(...content) { + return content.join('\n'); +} +function enclose(tag, content, attr) { + return app(open(tag + (attr ? ' ' + attr : '')), content, close(tag)); +} +const DETAILS = 'details'; +const OPEN_ATTR = 'open'; +const SUMMARY = 'summary'; +function detail(summary, details, closed = true) { + return enclose(DETAILS, app(enclose(SUMMARY, summary, closed ? undefined : OPEN_ATTR), details)); +} +exports.detail = detail; +const TABLE = 'table'; +const TR = 'tr'; +const TH = 'th'; +const TD = 'td'; +const COLSPAN_ATTR = 'colspan='; +function mark_cell(content, header = false, span) { + return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined); +} +function cell(cell) { + if (typeof cell === 'string') + return mark_cell(cell); + return mark_cell(cell.content, cell.header, cell.span); +} +function row(row) { + return enclose(TR, row.map(cell).join('\n')); +} +function makeHeaderRow(...names) { + return names.map(n => { return { content: n, header: true }; }); +} +exports.makeHeaderRow = makeHeaderRow; +function table(table) { + return enclose(TABLE, table.map(row).join('\n')); +} +exports.table = table; +const CODE = "code"; +const PRE = "pre"; +const LANG_ATTR = "lang="; +var LANG; +(function (LANG) { + LANG["MERMAID"] = "mermaid"; +})(LANG = exports.LANG || (exports.LANG = {})); +function code(lang, code) { + return enclose(PRE, enclose(CODE, code), LANG_ATTR + lang); +} +exports.code = code; +function mermaidPie(title, showData, ...data) { + return code(LANG.MERMAID, `pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.size).join("\n\t")}`); +} +exports.mermaidPie = mermaidPie; +const BOLD = "b"; +function bold(input) { + return enclose(BOLD, input); +} +exports.bold = bold; + + /***/ }), /***/ 1165: @@ -67947,6 +68021,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); +const mark = __importStar(__nccwpck_require__(4270)); const utils_1 = __nccwpck_require__(1314); const dashboardNIDef_1 = __nccwpck_require__(6014); const buildOutputDef_1 = __nccwpck_require__(1833); @@ -67967,24 +68042,37 @@ function setUpNIBuildReport() { }); } exports.setUpNIBuildReport = setUpNIBuildReport; +const descend = (v1, v2) => v2.size - v1.size; +const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; let heap = heapBreakdown[dashboardNIDef_1.HEAP_SIZE]; let code = codeBreakdown[dashboardNIDef_1.CODE_SIZE]; - heap.sort((v1, v2) => v2.size - v1.size); + const heapSum = heap.map(v => v.size).reduce(sum); + const codeSum = code.map(v => v.size).reduce(sum); + heap.sort(descend); heap = heap.slice(0, 10); - code = aggregateCode(code); - code.sort((v1, v2) => v2.size - v1.size); - code = code.slice(0, 10); - const heapSum = heap.map(v => v.size).reduce((v1, v2) => v1 + v2); - const codeSum = code.map(v => v.size).reduce((v1, v2) => v1 + v2); - addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", value: heapSum }, { name: "Code size", value: codeSum }); - addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, `${h.size}`, (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("10 Top Code sizes", ["Name", "Size", "%"], ...code.map(c => [c.name, `${c.size}`, (c.size / codeSum * 100).toFixed(2)])); + let pCode = parsePackages(code); + addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); + addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); + addTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); } exports.createNIArtifactReport = createNIArtifactReport; +function processPackage(pkg) { + const boldName = mark.bold(pkg[dashboardNIDef_1.NAME]); + if (pkg.pkg.size > 0) + return mark.detail(boldName, packageToTable(pkg)); + return boldName; +} +function packageToTable(pkg) { + return packagesToTable([...pkg.pkg.values()]); +} +function packagesToTable(pkgs) { + const rows = [mark.makeHeaderRow("Name", "Size")]; + return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), utils_1.hRBytes(cd[dashboardNIDef_1.SIZE])]))); +} function createNIBuildReport() { const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); @@ -67994,57 +68082,78 @@ function createNIBuildReport() { exports.createNIBuildReport = createNIBuildReport; function analysisResultEntryToTableRow(entry) { return [entry[0], - `${entry[1].total}`, - `${entry[1].reflection}`, - `${entry[1].jni}`, - `${entry[1].reachable}`]; + utils_1.hRBytes(entry[1].total), + utils_1.hRBytes(entry[1].reflection), + utils_1.hRBytes(entry[1].jni), + utils_1.hRBytes(entry[1].reachable)]; } function imageDetailsToTableRows(imageDetails) { const out = []; const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; - out.push(["Heap", `${imageHeap[buildOutputDef_1.BYTES]}`]); - out.push(["Resources", `${imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES]}`]); - out.push(["Code", `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]}`]); - out.push(["Total", `${imageDetails[buildOutputDef_1.TOTAL_BYTES]}`]); + out.push(["Heap", utils_1.hRBytes(imageHeap[buildOutputDef_1.BYTES])]); + out.push(["Resources", utils_1.hRBytes(imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES])]); + out.push(["Code", utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES])]); + out.push(["Total", utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES])]); return out; } function resourceUsageToTableRows(resourceUsage) { const out = []; - out.push(["Memory usage", resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL] + " B"]); - out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES]).toFixed(2) + "%"]); + out.push(["Memory usage", utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL])]); + out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES] * 100).toFixed(2) + "%"]); return out; } -function aggregateCode(code) { - const aggregates = new Map(); - code.forEach(element => { - const pkg = parsePkg(element.name); - aggregates.set(pkg, (aggregates.get(pkg) || 0) + element.size); +function parsePackages(code) { + const pkgs = new Map(); + code.forEach(c => { + const parts = c[dashboardNIDef_1.NAME].split('.'); + let prt = 0; + let p = { name: "", size: 0, pkg: new Map() }; + let m = pkgs; + for (const part of parts) { + if (part === part.toLowerCase()) { + p = appMap(part, c[dashboardNIDef_1.SIZE], m); + m = p.pkg; + prt += part.length + 1; + } + else { + break; + } + } }); - code = []; - aggregates.forEach((s, n) => code.push({ name: n, size: s })); - return code; -} -function parsePkg(name) { - const parts = name.split('.'); - let pkg = []; - for (const part of parts) { - if (part === part.toLowerCase()) { - pkg.push(part); - } - else - break; + return mergePackages([...pkgs.values()]); +} +function mergePackages(pkgs) { + pkgs.forEach(mergePackage); + return pkgs; +} +function mergePackage(pkg) { + if (pkg.pkg.size === 1) { + const pack = pkg.pkg.get(pkg.pkg.keys().next().value); + pkg[dashboardNIDef_1.NAME] = pkg[dashboardNIDef_1.NAME] + "." + pack[dashboardNIDef_1.NAME]; + pkg.pkg = pack.pkg; + mergePackage(pkg); + } + else + mergePackages([...pkg.pkg.values()]); + return pkg; +} +function appMap(part, size, map) { + let next = map.get(part); + if (next === undefined) { + next = { name: part, size: 0, pkg: new Map() }; + map.set(part, next); } - return pkg.join('.'); + next.size += size; + return next; } function addMermaidPieSummary(title, showData, ...data) { - //%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%\n - core.summary.addCodeBlock(`pie ${showData ? "showData " : ""}title ${title}\n\t${data.map(v1 => "\"" + v1.name + "\":" + v1.value).join("\n\t")}`, "mermaid"); + core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); } function addTableSummary(title, colNames, ...data) { const rows = []; - rows.push([{ data: title, header: true, colspan: `${colNames.length}` }]); - rows.push(colNames.map(name => { return { data: name, header: true }; })); - core.summary.addTable(rows.concat(data)); + rows.push([{ content: title, header: true, span: colNames.length }]); + rows.push(colNames.map(name => { return { content: name, header: true }; })); + core.summary.addRaw(mark.table(rows.concat(data))); } function addTableSummaryNoHeader(title, ...data) { const rows = []; @@ -68052,8 +68161,8 @@ function addTableSummaryNoHeader(title, ...data) { for (const row of data) { max = Math.max(row.length, max); } - rows.push([{ data: title, header: true, colspan: `${max}` }]); - core.summary.addTable(rows.concat(data)); + rows.push([{ content: title, header: true, span: max }]); + core.summary.addRaw(mark.table(rows.concat(data))); } @@ -68093,7 +68202,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; const c = __importStar(__nccwpck_require__(9042)); const gu_1 = __nccwpck_require__(5609); const core = __importStar(__nccwpck_require__(2186)); @@ -68231,6 +68340,16 @@ function getGVMversion() { }); } exports.getGVMversion = getGVMversion; +const sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; +const k = Math.pow(2, 10); +function hRBytes(bytes, decimals = 2) { + if (bytes <= 0) + return '0 Bytes'; + const dm = decimals < 0 ? 0 : decimals; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} +exports.hRBytes = hRBytes; /***/ }), From afb476da483c3061395fbf6b2b000477daf3a077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Tue, 1 Nov 2022 16:19:31 +0100 Subject: [PATCH 8/9] Drop Artifact summary. + Improve Build Output summary. --- dist/cleanup/index.js | 209 ++++++++++++++++++++++++++++++++---------- dist/main/index.js | 195 ++++++++++++++++++++++++++++++--------- src/cleanup.ts | 22 ++++- src/constants.ts | 5 +- src/main.ts | 6 +- src/markdown.ts | 46 ++++++++-- src/options.ts | 15 ++- src/reports.ts | 137 ++++++++++++++++++++------- 8 files changed, 491 insertions(+), 144 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 9690140..a7dfaa2 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -67030,12 +67030,22 @@ function run() { return __awaiter(this, void 0, void 0, function* () { let reported = false; if (yield options_1.isNativeImageBuildReport()) { - reports_1.createNIBuildReport(); - reported = true; + const report = yield reports_1.createNIBuildReport(); + if (options_1.isPrReport()) { + } + if (options_1.isJobReport()) { + core.summary.addRaw(report); + reported = true; + } } if (yield options_1.isNativeImageArtifactReport()) { - reports_1.createNIArtifactReport(); - reported = true; + const report = reports_1.createNIArtifactReport(); + if (options_1.isPrReport()) { + } + if (options_1.isJobReport()) { + core.summary.addRaw(report); + reported = true; + } } if (reported) core.summary.write(); @@ -67060,7 +67070,7 @@ else { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_BUILD = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -67069,8 +67079,9 @@ exports.INPUT_GITHUB_TOKEN = 'github-token'; exports.INPUT_SET_JAVA_HOME = 'set-java-home'; exports.INPUT_CACHE = 'cache'; exports.INPUT_NI_MUSL = 'native-image-musl'; -exports.INPUT_NI_REPORT_BUILD = 'native-image-report-build'; -exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact'; +exports.INPUT_NI_REPORT_JOB = 'native-image-job-summary'; +exports.INPUT_NI_REPORT_PR = 'native-image-pr-summary'; +exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-artifact-report'; exports.IS_LINUX = process.platform === 'linux'; exports.IS_MACOS = process.platform === 'darwin'; exports.IS_WINDOWS = process.platform === 'win32'; @@ -67239,7 +67250,7 @@ exports.getVersionString = getVersionString; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.makeHeaderRow = exports.detail = void 0; +exports.italic = exports.header = exports.link = exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.ALIGN = exports.toHeaderRow = exports.makeHeaderRow = exports.detail = void 0; function open(tag) { return '<' + tag + '>'; } @@ -67249,8 +67260,12 @@ function close(tag) { function app(...content) { return content.join('\n'); } -function enclose(tag, content, attr) { - return app(open(tag + (attr ? ' ' + attr : '')), content, close(tag)); +function enclose(tag, content, ...attrs) { + return app(open(tag + concatAttrs(attrs)), content, close(tag)); +} +function concatAttrs(attrs) { + const out = attrs.filter(a => a).join(' '); + return out.length === 0 ? out : ' ' + out; } const DETAILS = 'details'; const OPEN_ATTR = 'open'; @@ -67264,13 +67279,13 @@ const TR = 'tr'; const TH = 'th'; const TD = 'td'; const COLSPAN_ATTR = 'colspan='; -function mark_cell(content, header = false, span) { - return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined); +function mark_cell(content, header = false, span, alignment) { + return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined, alignment ? `${ALIGN_ATTR}"${alignment}"` : undefined); } function cell(cell) { if (typeof cell === 'string') return mark_cell(cell); - return mark_cell(cell.content, cell.header, cell.span); + return mark_cell(cell.content, cell.header, cell.span, cell.alignment); } function row(row) { return enclose(TR, row.map(cell).join('\n')); @@ -67279,6 +67294,18 @@ function makeHeaderRow(...names) { return names.map(n => { return { content: n, header: true }; }); } exports.makeHeaderRow = makeHeaderRow; +function toHeaderRow(...row) { + row.forEach(r => r.header = true); + return row; +} +exports.toHeaderRow = toHeaderRow; +var ALIGN; +(function (ALIGN) { + ALIGN["LEFT"] = "left"; + ALIGN["CENTER"] = "center"; + ALIGN["RIGHT"] = "right"; +})(ALIGN = exports.ALIGN || (exports.ALIGN = {})); +const ALIGN_ATTR = "align="; function table(table) { return enclose(TABLE, table.map(row).join('\n')); } @@ -67303,6 +67330,24 @@ function bold(input) { return enclose(BOLD, input); } exports.bold = bold; +const A = "a"; +const HREF_ATTR = "href="; +function link(text, link) { + return enclose(A, text, HREF_ATTR + `"${link}"`); +} +exports.link = link; +const H = "h"; +function header(input, importance = 6) { + if (importance > 6 || importance < 1) + return input; + return enclose(H + importance, input); +} +exports.header = header; +const I = "i"; +function italic(input) { + return enclose(I, input); +} +exports.italic = italic; /***/ }), @@ -67341,7 +67386,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isNativeImageArtifactReport = exports.isNativeImageBuildReport = void 0; +exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; const core = __importStar(__nccwpck_require__(2186)); const c = __importStar(__nccwpck_require__(9042)); const utils_1 = __nccwpck_require__(1314); @@ -67349,18 +67394,30 @@ function isNativeImageBuildReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); + return correctVersion && (isJobReport() || isPrReport()); }); } exports.isNativeImageBuildReport = isNativeImageBuildReport; +function isJobReport() { + return core.getBooleanInput(c.INPUT_NI_REPORT_JOB); +} +exports.isJobReport = isJobReport; +function isPrReport() { + return core.getBooleanInput(c.INPUT_NI_REPORT_PR); +} +exports.isPrReport = isPrReport; function isNativeImageArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); + return correctVersion && isArtReport(); }); } exports.isNativeImageArtifactReport = isNativeImageArtifactReport; +function isArtReport() { + return false; //core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); +} +exports.isArtReport = isArtReport; /***/ }), @@ -67401,11 +67458,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; const fs = __importStar(__nccwpck_require__(7147)); -const core = __importStar(__nccwpck_require__(2186)); const mark = __importStar(__nccwpck_require__(4270)); const utils_1 = __nccwpck_require__(1314); const dashboardNIDef_1 = __nccwpck_require__(6014); const buildOutputDef_1 = __nccwpck_require__(1833); +const gu = __importStar(__nccwpck_require__(5609)); function setUpNIArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); @@ -67426,6 +67483,7 @@ exports.setUpNIBuildReport = setUpNIBuildReport; const descend = (v1, v2) => v2.size - v1.size; const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { + let out = ""; const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; @@ -67436,13 +67494,14 @@ function createNIArtifactReport() { heap.sort(descend); heap = heap.slice(0, 10); let pCode = parsePackages(code); - addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); - addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); + out += makeMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); + out += makeTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); + out += makeTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); + return out; } exports.createNIArtifactReport = createNIArtifactReport; function processPackage(pkg) { - const boldName = mark.bold(pkg[dashboardNIDef_1.NAME]); + const boldName = mark.bold(pkg[buildOutputDef_1.NAME]); if (pkg.pkg.size > 0) return mark.detail(boldName, packageToTable(pkg)); return boldName; @@ -67455,38 +67514,91 @@ function packagesToTable(pkgs) { return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), utils_1.hRBytes(cd[dashboardNIDef_1.SIZE])]))); } function createNIBuildReport() { - const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); - addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); - addTableSummaryNoHeader("Resource usage", ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); - addTableSummary("Analysis Results", ["Type", "Total", "Reflection", "JNI", "Reachable"], ...Object.entries(data[buildOutputDef_1.ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); + let out = mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); + out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${yield gu.getVersionString()}`; + out += mark.header("Analysis Results", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Classes", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Fields", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Methods", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }), ...analysisResultsToTableRows(data[buildOutputDef_1.ANALYSIS_RESULTS])); + out += mark.header("Image Details", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Size", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Details", alignment: mark.ALIGN.LEFT }), ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); + out += mark.header("Resource usage", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "" }), ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); + out += mark.italic(`Report generated by ${mark.link("setup-graalvm", "https://github.com/marketplace/actions/github-action-for-graalvm")}.`); + return out; + }); } exports.createNIBuildReport = createNIBuildReport; -function analysisResultEntryToTableRow(entry) { - return [entry[0], - utils_1.hRBytes(entry[1].total), - utils_1.hRBytes(entry[1].reflection), - utils_1.hRBytes(entry[1].jni), - utils_1.hRBytes(entry[1].reachable)]; -} function imageDetailsToTableRows(imageDetails) { const out = []; - const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; - out.push(["Heap", utils_1.hRBytes(imageHeap[buildOutputDef_1.BYTES])]); - out.push(["Resources", utils_1.hRBytes(imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES])]); - out.push(["Code", utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES])]); - out.push(["Total", utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES])]); + out.push([ + mark.link("Code area", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-code-area"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.COMPILATION_UNITS]} compilation units`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Image heap", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-image-heap"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.RESOURCES][buildOutputDef_1.COUNT]} resources`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Other data", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-other-data"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES] - imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES] - imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.TOTAL_BYTES] - imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES] - imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, "" + ]); + out.push([ + "Total", { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: "100%", alignment: mark.ALIGN.RIGHT }, "" + ]); return out; } +function analysisResultsToTableRows(results) { + const out = []; + out.push([mark.link("Reachable", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reachability"), + ...translateResults(results, r => r.reachable)]); + out.push([mark.link("Reflection", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reflection-registrations"), + ...translateResults(results, r => r.reflection)]); + out.push([mark.link("JNI", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-jni-access-registrations"), + ...translateResults(results, r => r.jni)]); + out.push([mark.link("Loaded", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#reachable-classes-fields-and-methods"), + ...translateResults(results, r => r.total)]); + return out; +} +function translateResults(results, transformer) { + return [...translateResult(results[buildOutputDef_1.CLASSES], transformer), + ...translateResult(results[buildOutputDef_1.FIELDS], transformer), + ...translateResult(results[buildOutputDef_1.METHODS], transformer)]; +} +function translateResult(result, transformer) { + const current = transformer(result); + return [{ content: `${current}`, alignment: mark.ALIGN.RIGHT }, + { content: asPercent(result.total, current), alignment: mark.ALIGN.RIGHT }]; +} +function asPercent(total, part, precission = 2) { + return (part / total * 100).toFixed(precission) + "%"; +} function resourceUsageToTableRows(resourceUsage) { const out = []; - out.push(["Memory usage", utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL])]); - out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES] * 100).toFixed(2) + "%"]); + out.push([ + mark.link("GCs", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-garbage-collections"), + { content: `${resourceUsage[buildOutputDef_1.GARBAGE_COLLECTION][buildOutputDef_1.TOTAL_SECS]}s in ${resourceUsage[buildOutputDef_1.GARBAGE_COLLECTION][buildOutputDef_1.COUNT]} GCs`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Peak RSS", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-peak-rss"), + { content: utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.PEAK_RSS_BYTES]), alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("CPU load", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-cpu-load"), + { content: `${resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD].toFixed(2)}`, alignment: mark.ALIGN.LEFT } + ]); return out; } function parsePackages(code) { const pkgs = new Map(); code.forEach(c => { - const parts = c[dashboardNIDef_1.NAME].split('.'); + const parts = c[buildOutputDef_1.NAME].split('.'); let prt = 0; let p = { name: "", size: 0, pkg: new Map() }; let m = pkgs; @@ -67510,7 +67622,7 @@ function mergePackages(pkgs) { function mergePackage(pkg) { if (pkg.pkg.size === 1) { const pack = pkg.pkg.get(pkg.pkg.keys().next().value); - pkg[dashboardNIDef_1.NAME] = pkg[dashboardNIDef_1.NAME] + "." + pack[dashboardNIDef_1.NAME]; + pkg[buildOutputDef_1.NAME] = pkg[buildOutputDef_1.NAME] + "." + pack[buildOutputDef_1.NAME]; pkg.pkg = pack.pkg; mergePackage(pkg); } @@ -67527,23 +67639,26 @@ function appMap(part, size, map) { next.size += size; return next; } -function addMermaidPieSummary(title, showData, ...data) { - core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); +function makeMermaidPieSummary(title, showData, ...data) { + return mark.mermaidPie(title, showData, ...data); } -function addTableSummary(title, colNames, ...data) { +function makeTableSummary(title, colNames, ...data) { const rows = []; rows.push([{ content: title, header: true, span: colNames.length }]); rows.push(colNames.map(name => { return { content: name, header: true }; })); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); } -function addTableSummaryNoHeader(title, ...data) { +function makeTableSummaryNoHeader(title, ...data) { const rows = []; let max = 0; for (const row of data) { max = Math.max(row.length, max); } rows.push([{ content: title, header: true, span: max }]); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); +} +function makeTableSummaryRaw(...data) { + return mark.table(data); } diff --git a/dist/main/index.js b/dist/main/index.js index ef0d1f0..8d6f514 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -66938,7 +66938,7 @@ function isProbablyGradleDaemonProblem(packageManager, error) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_BUILD = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -66947,8 +66947,9 @@ exports.INPUT_GITHUB_TOKEN = 'github-token'; exports.INPUT_SET_JAVA_HOME = 'set-java-home'; exports.INPUT_CACHE = 'cache'; exports.INPUT_NI_MUSL = 'native-image-musl'; -exports.INPUT_NI_REPORT_BUILD = 'native-image-report-build'; -exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact'; +exports.INPUT_NI_REPORT_JOB = 'native-image-job-summary'; +exports.INPUT_NI_REPORT_PR = 'native-image-pr-summary'; +exports.INPUT_NI_REPORT_ARTIFACT = 'native-image-artifact-report'; exports.IS_LINUX = process.platform === 'linux'; exports.IS_MACOS = process.platform === 'darwin'; exports.IS_WINDOWS = process.platform === 'win32'; @@ -67659,13 +67660,13 @@ function run() { if (yield options_1.isNativeImageArtifactReport()) { yield reports_1.setUpNIArtifactReport(); } - else if (core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT)) { + else if (options_1.isArtReport()) { core.notice(`Artifact report isn't available for GraalVM version ${graalvmVersion}.`); } if (yield options_1.isNativeImageBuildReport()) { yield reports_1.setUpNIBuildReport(); } - else if (core.getBooleanInput(c.INPUT_NI_REPORT_BUILD)) { + else if (options_1.isJobReport() || options_1.isPrReport()) { core.notice(`Build report isn't available for GraalVM version ${graalvmVersion}.`); } if (cache && cache_1.isFeatureAvailable()) { @@ -67775,7 +67776,7 @@ function determineToolName(javaVersion) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.makeHeaderRow = exports.detail = void 0; +exports.italic = exports.header = exports.link = exports.bold = exports.mermaidPie = exports.code = exports.LANG = exports.table = exports.ALIGN = exports.toHeaderRow = exports.makeHeaderRow = exports.detail = void 0; function open(tag) { return '<' + tag + '>'; } @@ -67785,8 +67786,12 @@ function close(tag) { function app(...content) { return content.join('\n'); } -function enclose(tag, content, attr) { - return app(open(tag + (attr ? ' ' + attr : '')), content, close(tag)); +function enclose(tag, content, ...attrs) { + return app(open(tag + concatAttrs(attrs)), content, close(tag)); +} +function concatAttrs(attrs) { + const out = attrs.filter(a => a).join(' '); + return out.length === 0 ? out : ' ' + out; } const DETAILS = 'details'; const OPEN_ATTR = 'open'; @@ -67800,13 +67805,13 @@ const TR = 'tr'; const TH = 'th'; const TD = 'td'; const COLSPAN_ATTR = 'colspan='; -function mark_cell(content, header = false, span) { - return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined); +function mark_cell(content, header = false, span, alignment) { + return enclose(header ? TH : TD, content, span ? COLSPAN_ATTR + span : undefined, alignment ? `${ALIGN_ATTR}"${alignment}"` : undefined); } function cell(cell) { if (typeof cell === 'string') return mark_cell(cell); - return mark_cell(cell.content, cell.header, cell.span); + return mark_cell(cell.content, cell.header, cell.span, cell.alignment); } function row(row) { return enclose(TR, row.map(cell).join('\n')); @@ -67815,6 +67820,18 @@ function makeHeaderRow(...names) { return names.map(n => { return { content: n, header: true }; }); } exports.makeHeaderRow = makeHeaderRow; +function toHeaderRow(...row) { + row.forEach(r => r.header = true); + return row; +} +exports.toHeaderRow = toHeaderRow; +var ALIGN; +(function (ALIGN) { + ALIGN["LEFT"] = "left"; + ALIGN["CENTER"] = "center"; + ALIGN["RIGHT"] = "right"; +})(ALIGN = exports.ALIGN || (exports.ALIGN = {})); +const ALIGN_ATTR = "align="; function table(table) { return enclose(TABLE, table.map(row).join('\n')); } @@ -67839,6 +67856,24 @@ function bold(input) { return enclose(BOLD, input); } exports.bold = bold; +const A = "a"; +const HREF_ATTR = "href="; +function link(text, link) { + return enclose(A, text, HREF_ATTR + `"${link}"`); +} +exports.link = link; +const H = "h"; +function header(input, importance = 6) { + if (importance > 6 || importance < 1) + return input; + return enclose(H + importance, input); +} +exports.header = header; +const I = "i"; +function italic(input) { + return enclose(I, input); +} +exports.italic = italic; /***/ }), @@ -67960,7 +67995,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isNativeImageArtifactReport = exports.isNativeImageBuildReport = void 0; +exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; const core = __importStar(__nccwpck_require__(2186)); const c = __importStar(__nccwpck_require__(9042)); const utils_1 = __nccwpck_require__(1314); @@ -67968,18 +68003,30 @@ function isNativeImageBuildReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); + return correctVersion && (isJobReport() || isPrReport()); }); } exports.isNativeImageBuildReport = isNativeImageBuildReport; +function isJobReport() { + return core.getBooleanInput(c.INPUT_NI_REPORT_JOB); +} +exports.isJobReport = isJobReport; +function isPrReport() { + return core.getBooleanInput(c.INPUT_NI_REPORT_PR); +} +exports.isPrReport = isPrReport; function isNativeImageArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); + return correctVersion && isArtReport(); }); } exports.isNativeImageArtifactReport = isNativeImageArtifactReport; +function isArtReport() { + return false; //core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); +} +exports.isArtReport = isArtReport; /***/ }), @@ -68020,11 +68067,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createNIBuildReport = exports.createNIArtifactReport = exports.setUpNIBuildReport = exports.setUpNIArtifactReport = void 0; const fs = __importStar(__nccwpck_require__(7147)); -const core = __importStar(__nccwpck_require__(2186)); const mark = __importStar(__nccwpck_require__(4270)); const utils_1 = __nccwpck_require__(1314); const dashboardNIDef_1 = __nccwpck_require__(6014); const buildOutputDef_1 = __nccwpck_require__(1833); +const gu = __importStar(__nccwpck_require__(5609)); function setUpNIArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); @@ -68045,6 +68092,7 @@ exports.setUpNIBuildReport = setUpNIBuildReport; const descend = (v1, v2) => v2.size - v1.size; const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { + let out = ""; const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; @@ -68055,13 +68103,14 @@ function createNIArtifactReport() { heap.sort(descend); heap = heap.slice(0, 10); let pCode = parsePackages(code); - addMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); - addTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); + out += makeMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); + out += makeTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, utils_1.hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); + out += makeTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), utils_1.hRBytes(c.size)])); + return out; } exports.createNIArtifactReport = createNIArtifactReport; function processPackage(pkg) { - const boldName = mark.bold(pkg[dashboardNIDef_1.NAME]); + const boldName = mark.bold(pkg[buildOutputDef_1.NAME]); if (pkg.pkg.size > 0) return mark.detail(boldName, packageToTable(pkg)); return boldName; @@ -68074,38 +68123,91 @@ function packagesToTable(pkgs) { return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), utils_1.hRBytes(cd[dashboardNIDef_1.SIZE])]))); } function createNIBuildReport() { - const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); - addTableSummary("Image details", ["Type", "Bytes"], ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); - addTableSummaryNoHeader("Resource usage", ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); - addTableSummary("Analysis Results", ["Type", "Total", "Reflection", "JNI", "Reachable"], ...Object.entries(data[buildOutputDef_1.ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); + let out = mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); + out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${yield gu.getVersionString()}`; + out += mark.header("Analysis Results", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Classes", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Fields", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Methods", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }), ...analysisResultsToTableRows(data[buildOutputDef_1.ANALYSIS_RESULTS])); + out += mark.header("Image Details", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Size", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Details", alignment: mark.ALIGN.LEFT }), ...imageDetailsToTableRows(data[buildOutputDef_1.IMAGE_DETAILS])); + out += mark.header("Resource usage", 4); + out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "" }), ...resourceUsageToTableRows(data[buildOutputDef_1.RESOURCE_USAGE])); + out += mark.italic(`Report generated by ${mark.link("setup-graalvm", "https://github.com/marketplace/actions/github-action-for-graalvm")}.`); + return out; + }); } exports.createNIBuildReport = createNIBuildReport; -function analysisResultEntryToTableRow(entry) { - return [entry[0], - utils_1.hRBytes(entry[1].total), - utils_1.hRBytes(entry[1].reflection), - utils_1.hRBytes(entry[1].jni), - utils_1.hRBytes(entry[1].reachable)]; -} function imageDetailsToTableRows(imageDetails) { const out = []; - const imageHeap = imageDetails[buildOutputDef_1.IMAGE_HEAP]; - out.push(["Heap", utils_1.hRBytes(imageHeap[buildOutputDef_1.BYTES])]); - out.push(["Resources", utils_1.hRBytes(imageHeap[buildOutputDef_1.RESOURCES][buildOutputDef_1.BYTES])]); - out.push(["Code", utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES])]); - out.push(["Total", utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES])]); + out.push([ + mark.link("Code area", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-code-area"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.COMPILATION_UNITS]} compilation units`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Image heap", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-image-heap"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.RESOURCES][buildOutputDef_1.COUNT]} resources`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Other data", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-other-data"), + { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES] - imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES] - imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[buildOutputDef_1.TOTAL_BYTES], imageDetails[buildOutputDef_1.TOTAL_BYTES] - imageDetails[buildOutputDef_1.IMAGE_HEAP][buildOutputDef_1.BYTES] - imageDetails[buildOutputDef_1.CODE_AREA][buildOutputDef_1.BYTES]), alignment: mark.ALIGN.RIGHT }, "" + ]); + out.push([ + "Total", { content: utils_1.hRBytes(imageDetails[buildOutputDef_1.TOTAL_BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: "100%", alignment: mark.ALIGN.RIGHT }, "" + ]); + return out; +} +function analysisResultsToTableRows(results) { + const out = []; + out.push([mark.link("Reachable", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reachability"), + ...translateResults(results, r => r.reachable)]); + out.push([mark.link("Reflection", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reflection-registrations"), + ...translateResults(results, r => r.reflection)]); + out.push([mark.link("JNI", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-jni-access-registrations"), + ...translateResults(results, r => r.jni)]); + out.push([mark.link("Loaded", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#reachable-classes-fields-and-methods"), + ...translateResults(results, r => r.total)]); return out; } +function translateResults(results, transformer) { + return [...translateResult(results[buildOutputDef_1.CLASSES], transformer), + ...translateResult(results[buildOutputDef_1.FIELDS], transformer), + ...translateResult(results[buildOutputDef_1.METHODS], transformer)]; +} +function translateResult(result, transformer) { + const current = transformer(result); + return [{ content: `${current}`, alignment: mark.ALIGN.RIGHT }, + { content: asPercent(result.total, current), alignment: mark.ALIGN.RIGHT }]; +} +function asPercent(total, part, precission = 2) { + return (part / total * 100).toFixed(precission) + "%"; +} function resourceUsageToTableRows(resourceUsage) { const out = []; - out.push(["Memory usage", utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.SYSTEM_TOTAL])]); - out.push(["CPU usage", (resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD] / resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.TOTAL_CORES] * 100).toFixed(2) + "%"]); + out.push([ + mark.link("GCs", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-garbage-collections"), + { content: `${resourceUsage[buildOutputDef_1.GARBAGE_COLLECTION][buildOutputDef_1.TOTAL_SECS]}s in ${resourceUsage[buildOutputDef_1.GARBAGE_COLLECTION][buildOutputDef_1.COUNT]} GCs`, alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("Peak RSS", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-peak-rss"), + { content: utils_1.hRBytes(resourceUsage[buildOutputDef_1.MEMORY][buildOutputDef_1.PEAK_RSS_BYTES]), alignment: mark.ALIGN.LEFT } + ]); + out.push([ + mark.link("CPU load", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-cpu-load"), + { content: `${resourceUsage[buildOutputDef_1.CPU][buildOutputDef_1.LOAD].toFixed(2)}`, alignment: mark.ALIGN.LEFT } + ]); return out; } function parsePackages(code) { const pkgs = new Map(); code.forEach(c => { - const parts = c[dashboardNIDef_1.NAME].split('.'); + const parts = c[buildOutputDef_1.NAME].split('.'); let prt = 0; let p = { name: "", size: 0, pkg: new Map() }; let m = pkgs; @@ -68129,7 +68231,7 @@ function mergePackages(pkgs) { function mergePackage(pkg) { if (pkg.pkg.size === 1) { const pack = pkg.pkg.get(pkg.pkg.keys().next().value); - pkg[dashboardNIDef_1.NAME] = pkg[dashboardNIDef_1.NAME] + "." + pack[dashboardNIDef_1.NAME]; + pkg[buildOutputDef_1.NAME] = pkg[buildOutputDef_1.NAME] + "." + pack[buildOutputDef_1.NAME]; pkg.pkg = pack.pkg; mergePackage(pkg); } @@ -68146,23 +68248,26 @@ function appMap(part, size, map) { next.size += size; return next; } -function addMermaidPieSummary(title, showData, ...data) { - core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); +function makeMermaidPieSummary(title, showData, ...data) { + return mark.mermaidPie(title, showData, ...data); } -function addTableSummary(title, colNames, ...data) { +function makeTableSummary(title, colNames, ...data) { const rows = []; rows.push([{ content: title, header: true, span: colNames.length }]); rows.push(colNames.map(name => { return { content: name, header: true }; })); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); } -function addTableSummaryNoHeader(title, ...data) { +function makeTableSummaryNoHeader(title, ...data) { const rows = []; let max = 0; for (const row of data) { max = Math.max(row.length, max); } rows.push([{ content: title, header: true, span: max }]); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); +} +function makeTableSummaryRaw(...data) { + return mark.table(data); } diff --git a/src/cleanup.ts b/src/cleanup.ts index 6596bf3..16f031a 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -28,7 +28,7 @@ import * as core from '@actions/core' import * as constants from './constants' import { save } from './cache' import { createNIArtifactReport, createNIBuildReport } from './reports' -import { isNativeImageBuildReport, isNativeImageArtifactReport } from './options' +import { isNativeImageBuildReport, isNativeImageArtifactReport, isPrReport, isJobReport } from './options' /** * Check given input and run a save process for the specified package manager @@ -61,12 +61,24 @@ async function ignoreError(promise: Promise): Promise { export async function run(): Promise { let reported = false; if (await isNativeImageBuildReport()) { - createNIBuildReport(); - reported = true; + const report = await createNIBuildReport(); + if (isPrReport()) { + + } + if (isJobReport()) { + core.summary.addRaw(report); + reported = true; + } } if (await isNativeImageArtifactReport()) { - createNIArtifactReport(); - reported = true; + const report = createNIArtifactReport(); + if (isPrReport()) { + + } + if (isJobReport()) { + core.summary.addRaw(report); + reported = true; + } } if (reported) core.summary.write(); diff --git a/src/constants.ts b/src/constants.ts index 58084e7..fd30415 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,8 +8,9 @@ export const INPUT_GITHUB_TOKEN = 'github-token' export const INPUT_SET_JAVA_HOME = 'set-java-home' export const INPUT_CACHE = 'cache' export const INPUT_NI_MUSL = 'native-image-musl' -export const INPUT_NI_REPORT_BUILD = 'native-image-report-build' -export const INPUT_NI_REPORT_ARTIFACT = 'native-image-report-artifact' +export const INPUT_NI_REPORT_JOB = 'native-image-job-summary' +export const INPUT_NI_REPORT_PR = 'native-image-pr-summary' +export const INPUT_NI_REPORT_ARTIFACT = 'native-image-artifact-report' export const IS_LINUX = process.platform === 'linux' export const IS_MACOS = process.platform === 'darwin' diff --git a/src/main.ts b/src/main.ts index cd50975..1713ad4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import { setUpGUComponents } from './gu' import { setUpMandrel } from './mandrel' import { setUpNativeImageMusl } from './features' import { setUpWindowsEnvironment } from './msvc' -import { isNativeImageArtifactReport, isNativeImageBuildReport } from './options' +import { isArtReport, isJobReport, isNativeImageArtifactReport, isNativeImageBuildReport, isPrReport } from './options' import { setUpNIArtifactReport, setUpNIBuildReport } from './reports' async function run(): Promise { @@ -76,13 +76,13 @@ async function run(): Promise { if (await isNativeImageArtifactReport()) { await setUpNIArtifactReport() - } else if (core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT)) { + } else if (isArtReport()) { core.notice(`Artifact report isn't available for GraalVM version ${graalvmVersion}.`) } if (await isNativeImageBuildReport()) { await setUpNIBuildReport() - } else if (core.getBooleanInput(c.INPUT_NI_REPORT_BUILD)) { + } else if (isJobReport() || isPrReport()) { core.notice(`Build report isn't available for GraalVM version ${graalvmVersion}.`) } diff --git a/src/markdown.ts b/src/markdown.ts index 296ba79..f77348d 100644 --- a/src/markdown.ts +++ b/src/markdown.ts @@ -7,13 +7,17 @@ function close(tag: string): string { function app(...content: string[]): string { return content.join('\n'); } -function enclose(tag: string, content: string, attr?: string) { +function enclose(tag: string, content: string, ...attrs: (string | undefined)[]) { return app( - open(tag + (attr ? ' ' + attr : '')), + open(tag + concatAttrs(attrs)), content, close(tag)); } +function concatAttrs(attrs: (string | undefined)[]): string { + const out = attrs.filter(a => a).join(' '); + return out.length === 0 ? out : ' ' + out; +} const DETAILS = 'details'; const OPEN_ATTR = 'open'; const SUMMARY = 'summary'; @@ -30,17 +34,18 @@ const TR = 'tr'; const TH = 'th'; const TD = 'td'; const COLSPAN_ATTR = 'colspan='; -export type TableCell = { content: string, header?: boolean, span?: number }; +export type TableCell = { content: string, header?: boolean, span?: number, alignment?: ALIGN}; export type TableRow = (TableCell | string)[]; -function mark_cell(content: string, header: boolean = false, span?: number): string { +function mark_cell(content: string, header: boolean = false, span?: number, alignment?: ALIGN): string { return enclose(header ? TH : TD, content, - span ? COLSPAN_ATTR + span : undefined); + span ? COLSPAN_ATTR + span : undefined, + alignment ? `${ALIGN_ATTR}"${alignment}"` : undefined); } function cell(cell: TableCell | string): string { if (typeof cell === 'string') return mark_cell(cell); - return mark_cell(cell.content, cell.header, cell.span); + return mark_cell(cell.content, cell.header, cell.span, cell.alignment); } function row(row: TableRow) { return enclose(TR, row.map(cell).join('\n')); @@ -48,6 +53,18 @@ function row(row: TableRow) { export function makeHeaderRow(...names: string[]): TableRow { return names.map(n => { return { content: n, header: true } }); } + +export function toHeaderRow(...row:TableCell[]):TableRow{ + row.forEach(r=>r.header=true); + return row; +} + +export enum ALIGN { + LEFT = "left", + CENTER = "center", + RIGHT = "right" +} +const ALIGN_ATTR = "align=" export function table(table: TableRow[]): string { return enclose(TABLE, table.map(row).join('\n')); } @@ -70,4 +87,21 @@ export function mermaidPie(title: string, showData: boolean, ...data: MermaidPie const BOLD = "b"; export function bold(input: string): string { return enclose(BOLD, input); +} + +const A = "a"; +const HREF_ATTR = "href=" +export function link(text: string, link: string): string { + return enclose(A, text, HREF_ATTR + `"${link}"`); +} + +const H = "h"; +export function header(input: string, importance: number = 6): string { + if (importance > 6 || importance < 1) return input; + return enclose(H + importance, input); +} + +const I = "i"; +export function italic(input: string): string { + return enclose(I, input); } \ No newline at end of file diff --git a/src/options.ts b/src/options.ts index 3df45d5..bdeb7a5 100644 --- a/src/options.ts +++ b/src/options.ts @@ -5,11 +5,22 @@ import { getGVMversion } from "./utils"; export async function isNativeImageBuildReport(): Promise { const version = await getGVMversion(); const correctVersion = (version.major > 22 || version.major === 22 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_BUILD); + return correctVersion && (isJobReport() || isPrReport()); +} + +export function isJobReport(): boolean { + return core.getBooleanInput(c.INPUT_NI_REPORT_JOB); +} +export function isPrReport(): boolean { + return core.getBooleanInput(c.INPUT_NI_REPORT_PR); } export async function isNativeImageArtifactReport(): Promise { const version = await getGVMversion(); const correctVersion = (version.major > 20 || version.major === 20 && version.minor > 2); - return correctVersion && core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); + return correctVersion && isArtReport(); +} + +export function isArtReport():boolean{ + return false;//core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); } \ No newline at end of file diff --git a/src/reports.ts b/src/reports.ts index b058ede..ff5c79e 100644 --- a/src/reports.ts +++ b/src/reports.ts @@ -1,9 +1,9 @@ import * as fs from "fs"; -import * as core from "@actions/core"; import * as mark from "./markdown"; import { getGVMversion, hRBytes, setNativeImageOption } from "./utils"; -import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE, NAME, SIZE } from "./definitions/dashboardNIDef"; -import { AnalysisResult, ANALYSIS_RESULTS, BuildOutput, BYTES, CODE_AREA, CPU, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES } from "./definitions/buildOutputDef"; +import { CodeSize, CODE_BREAKDOWN, CODE_SIZE, DashboardDump, HeapSize, HEAP_BREAKDOWN, HEAP_SIZE, SIZE } from "./definitions/dashboardNIDef"; +import { AnalysisResult, AnalysisResults, ANALYSIS_RESULTS, BuildOutput, BYTES, CLASSES, CODE_AREA, COMPILATION_UNITS, COUNT, CPU, FIELDS, GARBAGE_COLLECTION, GENERAL_INFO, ImageDetails, ImageHeap, IMAGE_DETAILS, IMAGE_HEAP, LOAD, MEMORY, METHODS, NAME, PEAK_RSS_BYTES, RESOURCES, ResourceUsage, RESOURCE_USAGE, SYSTEM_TOTAL, TOTAL_BYTES, TOTAL_CORES, TOTAL_SECS } from "./definitions/buildOutputDef"; +import * as gu from "./gu"; export async function setUpNIArtifactReport(): Promise { const version = await getGVMversion(); @@ -22,7 +22,8 @@ type Sized = { size: number }; const descend = (v1: Sized, v2: Sized) => v2.size - v1.size; const sum = (n1: number, n2: number) => n1 + n2; -export function createNIArtifactReport(): void { +export function createNIArtifactReport(): string { + let out = ""; const data: DashboardDump = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[HEAP_BREAKDOWN]; const codeBreakdown = data[CODE_BREAKDOWN]; @@ -33,15 +34,16 @@ export function createNIArtifactReport(): void { heap.sort(descend); heap = heap.slice(0, 10); let pCode: Package[] = parsePackages(code); - addMermaidPieSummary("Heap/Code size", true, + out += makeMermaidPieSummary("Heap/Code size", true, { name: "Heap size", size: heapSum }, { name: "Code size", size: codeSum }); - addTableSummary("10 Top Heap sizes", + out += makeTableSummary("10 Top Heap sizes", ["Name", "Count", "Size", "%"], ...heap.map(h => [h.name, `${h.count}`, hRBytes(h.size), (h.size / heapSum * 100).toFixed(2)])); - addTableSummary("Code sizes by packages", + out += makeTableSummary("Code sizes by packages", ["Name", "Size"], ...pCode.sort(descend).map(c => [processPackage(c), hRBytes(c.size)])); + return out; } function processPackage(pkg: Package): string { @@ -60,39 +62,102 @@ function packagesToTable(pkgs: Package[]): string { return mark.table(rows.concat(pkgs.sort(descend).map(cd => [processPackage(cd), hRBytes(cd[SIZE])]))); } -export function createNIBuildReport(): void { +export async function createNIBuildReport(): Promise { const data: BuildOutput = JSON.parse(fs.readFileSync("outputReport.json").toString()); - addTableSummary("Image details", - ["Type", "Bytes"], + let out = mark.header(`Generated ${data[GENERAL_INFO][NAME]}`, 2); + out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${await gu.getVersionString()}` + + out += mark.header("Analysis Results", 4); + out += makeTableSummaryRaw( + mark.toHeaderRow( + { content: "Category", alignment: mark.ALIGN.LEFT }, + { content: "Classes", alignment: mark.ALIGN.RIGHT }, + { content: "in %", alignment: mark.ALIGN.RIGHT }, + { content: "Fields", alignment: mark.ALIGN.RIGHT }, + { content: "in %", alignment: mark.ALIGN.RIGHT }, + { content: "Methods", alignment: mark.ALIGN.RIGHT }, + { content: "in %", alignment: mark.ALIGN.RIGHT }), + ...analysisResultsToTableRows(data[ANALYSIS_RESULTS])); + out += mark.header("Image Details", 4); + out += makeTableSummaryRaw( + mark.toHeaderRow( + { content: "Category", alignment: mark.ALIGN.LEFT }, + { content: "Size", alignment: mark.ALIGN.RIGHT }, + { content: "in %", alignment: mark.ALIGN.RIGHT }, + { content: "Details", alignment: mark.ALIGN.LEFT }), ...imageDetailsToTableRows(data[IMAGE_DETAILS])); - addTableSummaryNoHeader("Resource usage", + out += mark.header("Resource usage", 4); + out += makeTableSummaryRaw( + mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "" }), ...resourceUsageToTableRows(data[RESOURCE_USAGE])); - addTableSummary("Analysis Results", - ["Type", "Total", "Reflection", "JNI", "Reachable"], - ...Object.entries(data[ANALYSIS_RESULTS]).map(analysisResultEntryToTableRow)); + out += mark.italic(`Report generated by ${mark.link("setup-graalvm", "https://github.com/marketplace/actions/github-action-for-graalvm")}.`); + return out; } -function analysisResultEntryToTableRow(entry: [string, AnalysisResult]): mark.TableRow { - return [entry[0], - hRBytes(entry[1].total), - hRBytes(entry[1].reflection), - hRBytes(entry[1].jni), - hRBytes(entry[1].reachable)]; +function imageDetailsToTableRows(imageDetails: ImageDetails): mark.TableRow[] { + const out: mark.TableRow[] = []; + out.push([ + mark.link("Code area", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-code-area"), + { content: hRBytes(imageDetails[CODE_AREA][BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[TOTAL_BYTES], imageDetails[CODE_AREA][BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[CODE_AREA][COMPILATION_UNITS]} compilation units`, alignment: mark.ALIGN.LEFT }]); + out.push([ + mark.link("Image heap", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-image-heap"), + { content: hRBytes(imageDetails[IMAGE_HEAP][BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[TOTAL_BYTES], imageDetails[IMAGE_HEAP][BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: `${imageDetails[IMAGE_HEAP][RESOURCES][COUNT]} resources`, alignment: mark.ALIGN.LEFT }]); + out.push([ + mark.link("Other data", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-other-data"), + { content: hRBytes(imageDetails[TOTAL_BYTES] - imageDetails[IMAGE_HEAP][BYTES] - imageDetails[CODE_AREA][BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: asPercent(imageDetails[TOTAL_BYTES], imageDetails[TOTAL_BYTES] - imageDetails[IMAGE_HEAP][BYTES] - imageDetails[CODE_AREA][BYTES]), alignment: mark.ALIGN.RIGHT }, ""]); + out.push([ + "Total", { content: hRBytes(imageDetails[TOTAL_BYTES]), alignment: mark.ALIGN.RIGHT }, + { content: "100%", alignment: mark.ALIGN.RIGHT }, ""]); + return out; } -function imageDetailsToTableRows(imageDetails: ImageDetails): mark.TableRow[] { +function analysisResultsToTableRows(results: AnalysisResults): mark.TableRow[] { const out: mark.TableRow[] = []; - const imageHeap: ImageHeap = imageDetails[IMAGE_HEAP]; - out.push(["Heap", hRBytes(imageHeap[BYTES])]); - out.push(["Resources", hRBytes(imageHeap[RESOURCES][BYTES])]); - out.push(["Code", hRBytes(imageDetails[CODE_AREA][BYTES])]); - out.push(["Total", hRBytes(imageDetails[TOTAL_BYTES])]); + out.push([mark.link("Reachable", + "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reachability"), + ...translateResults(results, r => r.reachable)]); + out.push([mark.link("Reflection", + "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-reflection-registrations"), + ...translateResults(results, r => r.reflection)]); + out.push([mark.link("JNI", + "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-jni-access-registrations"), + ...translateResults(results, r => r.jni)]); + out.push([mark.link("Loaded", + "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#reachable-classes-fields-and-methods"), + ...translateResults(results, r => r.total)]); return out; } + +function translateResults(results: AnalysisResults, transformer: (result: AnalysisResult) => number): mark.TableCell[] { + return [...translateResult(results[CLASSES], transformer), + ...translateResult(results[FIELDS], transformer), + ...translateResult(results[METHODS], transformer)]; +} +function translateResult(result: AnalysisResult, transformer: (result: AnalysisResult) => number): [mark.TableCell, mark.TableCell] { + const current = transformer(result); + return [{ content: `${current}`, alignment: mark.ALIGN.RIGHT }, + { content: asPercent(result.total, current), alignment: mark.ALIGN.RIGHT }]; +} + +function asPercent(total: number, part: number, precission: number = 2): string { + return (part / total * 100).toFixed(precission) + "%"; +} function resourceUsageToTableRows(resourceUsage: ResourceUsage): mark.TableRow[] { const out: mark.TableRow[] = []; - out.push(["Memory usage", hRBytes(resourceUsage[MEMORY][SYSTEM_TOTAL])]); - out.push(["CPU usage", (resourceUsage[CPU][LOAD] / resourceUsage[CPU][TOTAL_CORES] * 100).toFixed(2) + "%"]); + out.push([ + mark.link("GCs", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-garbage-collections"), + { content: `${resourceUsage[GARBAGE_COLLECTION][TOTAL_SECS]}s in ${resourceUsage[GARBAGE_COLLECTION][COUNT]} GCs`, alignment: mark.ALIGN.LEFT }]); + out.push([ + mark.link("Peak RSS", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-peak-rss"), + { content: hRBytes(resourceUsage[MEMORY][PEAK_RSS_BYTES]), alignment: mark.ALIGN.LEFT }]); + out.push([ + mark.link("CPU load", "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md#glossary-cpu-load"), + { content: `${resourceUsage[CPU][LOAD].toFixed(2)}`, alignment: mark.ALIGN.LEFT }]); return out; } @@ -143,22 +208,26 @@ function appMap(part: string, size: number, map: Map): Package return next; } -function addMermaidPieSummary(title: string, showData: boolean, ...data: mark.MermaidPieData[]) { - core.summary.addRaw(mark.mermaidPie(title, showData, ...data)); +function makeMermaidPieSummary(title: string, showData: boolean, ...data: mark.MermaidPieData[]): string { + return mark.mermaidPie(title, showData, ...data); } -function addTableSummary(title: string, colNames: string[], ...data: mark.TableRow[]) { +function makeTableSummary(title: string, colNames: string[], ...data: mark.TableRow[]): string { const rows: mark.TableRow[] = []; rows.push([{ content: title, header: true, span: colNames.length }]); rows.push(colNames.map(name => { return { content: name, header: true } })); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); } -function addTableSummaryNoHeader(title: string, ...data: mark.TableRow[]) { +function makeTableSummaryNoHeader(title: string, ...data: mark.TableRow[]): string { const rows: mark.TableRow[] = []; let max = 0; for (const row of data) { max = Math.max(row.length, max); } rows.push([{ content: title, header: true, span: max }]); - core.summary.addRaw(mark.table(rows.concat(data))); + return mark.table(rows.concat(data)); +} + +function makeTableSummaryRaw(...data: mark.TableRow[]): string { + return mark.table(data); } \ No newline at end of file From b110c98a3a25ee9230244e6016b88de08e334ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Douda?= Date: Wed, 2 Nov 2022 15:42:53 +0100 Subject: [PATCH 9/9] PR comment for reports. --- dist/cleanup/index.js | 2283 ++++++++++++++++++++++++++++++++++++++++- dist/main/index.js | 2271 +++++++++++++++++++++++++++++++++++++++- package-lock.json | 81 ++ package.json | 1 + src/cleanup.ts | 11 +- src/constants.ts | 4 + src/gu.ts | 5 +- src/options.ts | 12 +- src/reports.ts | 5 +- src/utils.ts | 19 +- 10 files changed, 4659 insertions(+), 33 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index a7dfaa2..0705313 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -5819,6 +5819,902 @@ class ExecState extends events.EventEmitter { /***/ }), +/***/ 4087: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Context = void 0; +const fs_1 = __nccwpck_require__(7147); +const os_1 = __nccwpck_require__(2037); +class Context { + /** + * Hydrate the context from the environment + */ + constructor() { + var _a, _b, _c; + this.payload = {}; + if (process.env.GITHUB_EVENT_PATH) { + if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) { + this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' })); + } + else { + const path = process.env.GITHUB_EVENT_PATH; + process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`); + } + } + this.eventName = process.env.GITHUB_EVENT_NAME; + this.sha = process.env.GITHUB_SHA; + this.ref = process.env.GITHUB_REF; + this.workflow = process.env.GITHUB_WORKFLOW; + this.action = process.env.GITHUB_ACTION; + this.actor = process.env.GITHUB_ACTOR; + this.job = process.env.GITHUB_JOB; + this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); + this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); + this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`; + this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`; + this.graphqlUrl = (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`; + } + get issue() { + const payload = this.payload; + return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number }); + } + get repo() { + if (process.env.GITHUB_REPOSITORY) { + const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); + return { owner, repo }; + } + if (this.payload.repository) { + return { + owner: this.payload.repository.owner.login, + repo: this.payload.repository.name + }; + } + throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); + } +} +exports.Context = Context; +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 5438: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getOctokit = exports.context = void 0; +const Context = __importStar(__nccwpck_require__(4087)); +const utils_1 = __nccwpck_require__(3030); +exports.context = new Context.Context(); +/** + * Returns a hydrated octokit ready to use for GitHub Actions + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokit(token, options, ...additionalPlugins) { + const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins); + return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options)); +} +exports.getOctokit = getOctokit; +//# sourceMappingURL=github.js.map + +/***/ }), + +/***/ 7914: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; +const httpClient = __importStar(__nccwpck_require__(6341)); +function getAuthString(token, options) { + if (!token && !options.auth) { + throw new Error('Parameter token or opts.auth is required'); + } + else if (token && options.auth) { + throw new Error('Parameters token and opts.auth may not both be specified'); + } + return typeof options.auth === 'string' ? options.auth : `token ${token}`; +} +exports.getAuthString = getAuthString; +function getProxyAgent(destinationUrl) { + const hc = new httpClient.HttpClient(); + return hc.getAgent(destinationUrl); +} +exports.getProxyAgent = getProxyAgent; +function getApiBaseUrl() { + return process.env['GITHUB_API_URL'] || 'https://api.github.com'; +} +exports.getApiBaseUrl = getApiBaseUrl; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 3030: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0; +const Context = __importStar(__nccwpck_require__(4087)); +const Utils = __importStar(__nccwpck_require__(7914)); +// octokit + plugins +const core_1 = __nccwpck_require__(6762); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044); +const plugin_paginate_rest_1 = __nccwpck_require__(4193); +exports.context = new Context.Context(); +const baseUrl = Utils.getApiBaseUrl(); +exports.defaults = { + baseUrl, + request: { + agent: Utils.getProxyAgent(baseUrl) + } +}; +exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults); +/** + * Convience function to correctly format Octokit Options to pass into the constructor. + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokitOptions(token, options) { + const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller + // Auth + const auth = Utils.getAuthString(token, opts); + if (auth) { + opts.auth = auth; + } + return opts; +} +exports.getOctokitOptions = getOctokitOptions; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 6341: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; +const http = __importStar(__nccwpck_require__(3685)); +const https = __importStar(__nccwpck_require__(5687)); +const pm = __importStar(__nccwpck_require__(3466)); +const tunnel = __importStar(__nccwpck_require__(4294)); +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + })); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + const parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + }); + } + get(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + }); + } + del(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + }); + } + post(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + }); + } + patch(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + }); + } + put(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + }); + } + head(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + }); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request(verb, requestUrl, stream, additionalHeaders); + }); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + getJson(requestUrl, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + const res = yield this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + postJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + putJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + patchJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + const parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + do { + response = yield this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (const handler of this.handlers) { + if (handler.canHandleAuthentication(response)) { + authenticationHandler = handler; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (response.message.statusCode && + HttpRedirectCodes.includes(response.message.statusCode) && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + const parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol === 'https:' && + parsedUrl.protocol !== parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + yield response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (const header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (!response.message.statusCode || + !HttpResponseRetryCodes.includes(response.message.statusCode)) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } while (numTries < maxTries); + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + function callbackForResult(err, res) { + if (err) { + reject(err); + } + else if (!res) { + // If `err` is not passed, then `res` must be passed. + reject(new Error('Unknown error')); + } + else { + resolve(res); + } + } + this.requestRawWithCallback(info, data, callbackForResult); + }); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + if (typeof data === 'string') { + if (!info.options.headers) { + info.options.headers = {}; + } + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + function handleResult(err, res) { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + } + const req = info.httpModule.request(info.options, (msg) => { + const res = new HttpClientResponse(msg); + handleResult(undefined, res); + }); + let socket; + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); + } + handleResult(new Error(`Request timeout: ${info.options.path}`)); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + const parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + for (const handler of this.handlers) { + handler.prepareRequest(info.options); + } + } + return info; + } + _mergeHeaders(headers) { + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. + if (proxyUrl && proxyUrl.hostname) { + const agentOptions = { + maxSockets, + keepAlive: this._keepAlive, + proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` + })), { host: proxyUrl.hostname, port: proxyUrl.port }) + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + return __awaiter(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 __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const statusCode = res.message.statusCode || 0; + const response = { + statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode === HttpCodes.NotFound) { + resolve(response); + } + // get the result from the body + function dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + const a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + let obj; + let contents; + try { + contents = yield res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = `Failed request: (${statusCode})`; + } + const err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + })); + }); + } +} +exports.HttpClient = HttpClient; +const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 3466: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkBypass = exports.getProxyUrl = void 0; +function getProxyUrl(reqUrl) { + const usingSsl = reqUrl.protocol === 'https:'; + if (checkBypass(reqUrl)) { + return undefined; + } + 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) { + return new URL(proxyVar); + } + else { + return undefined; + } +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + const upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (const upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; +//# sourceMappingURL=proxy.js.map + +/***/ }), + /***/ 8090: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -46584,6 +47480,1334 @@ exports.withCustomRequest = withCustomRequest; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 4193: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const VERSION = "2.21.3"; + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +/** + * Some “list” response that can be paginated have a different response structure + * + * They have a `total_count` key in the response (search also has `incomplete_results`, + * /installation/repositories also has `repository_selection`), as well as a key with + * the list of the items which name varies from endpoint to endpoint. + * + * Octokit normalizes these responses so that paginated results are always returned following + * the same structure. One challenge is that if the list response has only one page, no Link + * header is provided, so this header alone is not sufficient to check wether a response is + * paginated or not. + * + * We check if a "total_count" key is present in the response data, but also make sure that + * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would + * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + */ +function normalizePaginatedListResponse(response) { + // endpoints can respond with 204 if repository is empty + if (!response.data) { + return _objectSpread2(_objectSpread2({}, response), {}, { + data: [] + }); + } + + const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); + if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way + // to retrieve the same information. + + const incompleteResults = response.data.incomplete_results; + const repositorySelection = response.data.repository_selection; + const totalCount = response.data.total_count; + delete response.data.incomplete_results; + delete response.data.repository_selection; + delete response.data.total_count; + const namespaceKey = Object.keys(response.data)[0]; + const data = response.data[namespaceKey]; + response.data = data; + + if (typeof incompleteResults !== "undefined") { + response.data.incomplete_results = incompleteResults; + } + + if (typeof repositorySelection !== "undefined") { + response.data.repository_selection = repositorySelection; + } + + response.data.total_count = totalCount; + return response; +} + +function iterator(octokit, route, parameters) { + const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); + const requestMethod = typeof route === "function" ? route : octokit.request; + const method = options.method; + const headers = options.headers; + let url = options.url; + return { + [Symbol.asyncIterator]: () => ({ + async next() { + if (!url) return { + done: true + }; + + try { + const response = await requestMethod({ + method, + url, + headers + }); + const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format: + // '; rel="next", ; rel="last"' + // sets `url` to undefined if "next" URL is not present or `link` header is not set + + url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; + return { + value: normalizedResponse + }; + } catch (error) { + if (error.status !== 409) throw error; + url = ""; + return { + value: { + status: 200, + headers: {}, + data: [] + } + }; + } + } + + }) + }; +} + +function paginate(octokit, route, parameters, mapFn) { + if (typeof parameters === "function") { + mapFn = parameters; + parameters = undefined; + } + + return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); +} + +function gather(octokit, results, iterator, mapFn) { + return iterator.next().then(result => { + if (result.done) { + return results; + } + + let earlyExit = false; + + function done() { + earlyExit = true; + } + + results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); + + if (earlyExit) { + return results; + } + + return gather(octokit, results, iterator, mapFn); + }); +} + +const composePaginateRest = Object.assign(paginate, { + iterator +}); + +const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /applications/grants", "GET /authorizations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/audit-log", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /enterprises/{enterprise}/settings/billing/advanced-security", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/audit-log", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/external-groups", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/settings/billing/advanced-security", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/git/matching-refs/{ref}", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; + +function isPaginatingEndpoint(arg) { + if (typeof arg === "string") { + return paginatingEndpoints.includes(arg); + } else { + return false; + } +} + +/** + * @param octokit Octokit instance + * @param options Options passed to Octokit constructor + */ + +function paginateRest(octokit) { + return { + paginate: Object.assign(paginate.bind(null, octokit), { + iterator: iterator.bind(null, octokit) + }) + }; +} +paginateRest.VERSION = VERSION; + +exports.composePaginateRest = composePaginateRest; +exports.isPaginatingEndpoint = isPaginatingEndpoint; +exports.paginateRest = paginateRest; +exports.paginatingEndpoints = paginatingEndpoints; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3044: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +const Endpoints = { + actions: { + addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"], + addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], + approveWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"], + cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], + createOrUpdateEnvironmentSecret: ["PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + createRegistrationTokenForOrg: ["POST /orgs/{org}/actions/runners/registration-token"], + createRegistrationTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], + createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], + createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], + createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], + deleteActionsCacheById: ["DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"], + deleteActionsCacheByKey: ["DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"], + deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + deleteEnvironmentSecret: ["DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + deleteSelfHostedRunnerFromOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}"], + deleteSelfHostedRunnerFromRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"], + deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"], + deleteWorkflowRunLogs: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + disableSelectedRepositoryGithubActionsOrganization: ["DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"], + disableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"], + downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], + downloadJobLogsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], + downloadWorkflowRunAttemptLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"], + downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + enableSelectedRepositoryGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"], + enableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"], + getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"], + getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"], + getActionsCacheUsageByRepoForOrg: ["GET /orgs/{org}/actions/cache/usage-by-repository"], + getActionsCacheUsageForEnterprise: ["GET /enterprises/{enterprise}/actions/cache/usage"], + getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"], + getAllowedActionsOrganization: ["GET /orgs/{org}/actions/permissions/selected-actions"], + getAllowedActionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/selected-actions"], + getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getEnvironmentPublicKey: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"], + getEnvironmentSecret: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + getGithubActionsDefaultWorkflowPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsOrganization: ["GET /orgs/{org}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/workflow"], + getGithubActionsPermissionsOrganization: ["GET /orgs/{org}/actions/permissions"], + getGithubActionsPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions"], + getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], + getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], + getPendingDeploymentsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], + getRepoPermissions: ["GET /repos/{owner}/{repo}/actions/permissions", {}, { + renamed: ["actions", "getGithubActionsPermissionsRepository"] + }], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + getReviewsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"], + getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], + getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], + getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], + getWorkflowAccessToRepository: ["GET /repos/{owner}/{repo}/actions/permissions/access"], + getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], + getWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"], + getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], + getWorkflowUsage: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"], + listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], + listEnvironmentSecrets: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets"], + listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], + listJobsForWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"], + listLabelsForSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}/labels"], + listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], + listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], + listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"], + listRunnerApplicationsForRepo: ["GET /repos/{owner}/{repo}/actions/runners/downloads"], + listSelectedReposForOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}/repositories"], + listSelectedRepositoriesEnabledGithubActionsOrganization: ["GET /orgs/{org}/actions/permissions/repositories"], + listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"], + listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"], + listWorkflowRunArtifacts: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"], + listWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"], + listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"], + reRunJobForWorkflowRun: ["POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"], + reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"], + reRunWorkflowFailedJobs: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"], + removeAllCustomLabelsFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels"], + removeAllCustomLabelsFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"], + removeCustomLabelFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"], + removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], + reviewPendingDeploymentsForRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], + setAllowedActionsOrganization: ["PUT /orgs/{org}/actions/permissions/selected-actions"], + setAllowedActionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForOrg: ["PUT /orgs/{org}/actions/runners/{runner_id}/labels"], + setCustomLabelsForSelfHostedRunnerForRepo: ["PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + setGithubActionsDefaultWorkflowPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/workflow"], + setGithubActionsPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions"], + setGithubActionsPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions"], + setSelectedReposForOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"], + setSelectedRepositoriesEnabledGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories"], + setWorkflowAccessToRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/access"] + }, + activity: { + checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"], + deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"], + deleteThreadSubscription: ["DELETE /notifications/threads/{thread_id}/subscription"], + getFeeds: ["GET /feeds"], + getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"], + getThread: ["GET /notifications/threads/{thread_id}"], + getThreadSubscriptionForAuthenticatedUser: ["GET /notifications/threads/{thread_id}/subscription"], + listEventsForAuthenticatedUser: ["GET /users/{username}/events"], + listNotificationsForAuthenticatedUser: ["GET /notifications"], + listOrgEventsForAuthenticatedUser: ["GET /users/{username}/events/orgs/{org}"], + listPublicEvents: ["GET /events"], + listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"], + listPublicEventsForUser: ["GET /users/{username}/events/public"], + listPublicOrgEvents: ["GET /orgs/{org}/events"], + listReceivedEventsForUser: ["GET /users/{username}/received_events"], + listReceivedPublicEventsForUser: ["GET /users/{username}/received_events/public"], + listRepoEvents: ["GET /repos/{owner}/{repo}/events"], + listRepoNotificationsForAuthenticatedUser: ["GET /repos/{owner}/{repo}/notifications"], + listReposStarredByAuthenticatedUser: ["GET /user/starred"], + listReposStarredByUser: ["GET /users/{username}/starred"], + listReposWatchedByUser: ["GET /users/{username}/subscriptions"], + listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"], + listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"], + listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], + markNotificationsAsRead: ["PUT /notifications"], + markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], + setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], + setThreadSubscription: ["PUT /notifications/threads/{thread_id}/subscription"], + starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"], + unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"] + }, + apps: { + addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", {}, { + renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] + }], + addRepoToInstallationForAuthenticatedUser: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"], + checkToken: ["POST /applications/{client_id}/token"], + createFromManifest: ["POST /app-manifests/{code}/conversions"], + createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"], + deleteAuthorization: ["DELETE /applications/{client_id}/grant"], + deleteInstallation: ["DELETE /app/installations/{installation_id}"], + deleteToken: ["DELETE /applications/{client_id}/token"], + getAuthenticated: ["GET /app"], + getBySlug: ["GET /apps/{app_slug}"], + getInstallation: ["GET /app/installations/{installation_id}"], + getOrgInstallation: ["GET /orgs/{org}/installation"], + getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"], + getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"], + getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], + getUserInstallation: ["GET /users/{username}/installation"], + getWebhookConfigForApp: ["GET /app/hook/config"], + getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"], + listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], + listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], + listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"], + listInstallations: ["GET /app/installations"], + listInstallationsForAuthenticatedUser: ["GET /user/installations"], + listPlans: ["GET /marketplace_listing/plans"], + listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], + listReposAccessibleToInstallation: ["GET /installation/repositories"], + listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"], + listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], + listWebhookDeliveries: ["GET /app/hook/deliveries"], + redeliverWebhookDelivery: ["POST /app/hook/deliveries/{delivery_id}/attempts"], + removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", {}, { + renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] + }], + removeRepoFromInstallationForAuthenticatedUser: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"], + resetToken: ["PATCH /applications/{client_id}/token"], + revokeInstallationAccessToken: ["DELETE /installation/token"], + scopeToken: ["POST /applications/{client_id}/token/scoped"], + suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"], + unsuspendInstallation: ["DELETE /app/installations/{installation_id}/suspended"], + updateWebhookConfigForApp: ["PATCH /app/hook/config"] + }, + billing: { + getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"], + getGithubActionsBillingUser: ["GET /users/{username}/settings/billing/actions"], + getGithubAdvancedSecurityBillingGhe: ["GET /enterprises/{enterprise}/settings/billing/advanced-security"], + getGithubAdvancedSecurityBillingOrg: ["GET /orgs/{org}/settings/billing/advanced-security"], + getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"], + getGithubPackagesBillingUser: ["GET /users/{username}/settings/billing/packages"], + getSharedStorageBillingOrg: ["GET /orgs/{org}/settings/billing/shared-storage"], + getSharedStorageBillingUser: ["GET /users/{username}/settings/billing/shared-storage"] + }, + checks: { + create: ["POST /repos/{owner}/{repo}/check-runs"], + createSuite: ["POST /repos/{owner}/{repo}/check-suites"], + get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"], + getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"], + listAnnotations: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"], + listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"], + listForSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"], + listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"], + rerequestRun: ["POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"], + rerequestSuite: ["POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"], + setSuitesPreferences: ["PATCH /repos/{owner}/{repo}/check-suites/preferences"], + update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"] + }, + codeScanning: { + deleteAnalysis: ["DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"], + getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, { + renamedParameters: { + alert_id: "alert_number" + } + }], + getAnalysis: ["GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"], + getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"], + listAlertInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"], + listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"], + listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"], + listAlertsInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", {}, { + renamed: ["codeScanning", "listAlertInstances"] + }], + listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"], + updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"], + uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"] + }, + codesOfConduct: { + getAllCodesOfConduct: ["GET /codes_of_conduct"], + getConductCode: ["GET /codes_of_conduct/{key}"] + }, + codespaces: { + addRepositoryForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + codespaceMachinesForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/machines"], + createForAuthenticatedUser: ["POST /user/codespaces"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + createOrUpdateSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}"], + createWithPrForAuthenticatedUser: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"], + createWithRepoForAuthenticatedUser: ["POST /repos/{owner}/{repo}/codespaces"], + deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"], + deleteFromOrganization: ["DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + deleteSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}"], + exportForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/exports"], + getExportDetailsForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/exports/{export_id}"], + getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"], + getPublicKeyForAuthenticatedUser: ["GET /user/codespaces/secrets/public-key"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/codespaces/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + getSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}"], + listDevcontainersInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/devcontainers"], + listForAuthenticatedUser: ["GET /user/codespaces"], + listInOrganization: ["GET /orgs/{org}/codespaces", {}, { + renamedParameters: { + org_id: "org" + } + }], + listInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"], + listRepositoriesForSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}/repositories"], + listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"], + removeRepositoryForSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + repoMachinesForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/machines"], + setRepositoriesForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories"], + startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"], + stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"], + stopInOrganization: ["POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"], + updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] + }, + dependabot: { + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/dependabot/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"], + listSelectedReposForOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"], + removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + setSelectedReposForOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"] + }, + dependencyGraph: { + createRepositorySnapshot: ["POST /repos/{owner}/{repo}/dependency-graph/snapshots"], + diffRange: ["GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"] + }, + emojis: { + get: ["GET /emojis"] + }, + enterpriseAdmin: { + addCustomLabelsToSelfHostedRunnerForEnterprise: ["POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + disableSelectedOrganizationGithubActionsEnterprise: ["DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], + enableSelectedOrganizationGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], + getAllowedActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/selected-actions"], + getGithubActionsPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions"], + getServerStatistics: ["GET /enterprise-installation/{enterprise_or_org}/server-statistics"], + listLabelsForSelfHostedRunnerForEnterprise: ["GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + listSelectedOrganizationsEnabledGithubActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/organizations"], + removeAllCustomLabelsFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name}"], + setAllowedActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForEnterprise: ["PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + setGithubActionsPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions"], + setSelectedOrganizationsEnabledGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations"] + }, + gists: { + checkIsStarred: ["GET /gists/{gist_id}/star"], + create: ["POST /gists"], + createComment: ["POST /gists/{gist_id}/comments"], + delete: ["DELETE /gists/{gist_id}"], + deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"], + fork: ["POST /gists/{gist_id}/forks"], + get: ["GET /gists/{gist_id}"], + getComment: ["GET /gists/{gist_id}/comments/{comment_id}"], + getRevision: ["GET /gists/{gist_id}/{sha}"], + list: ["GET /gists"], + listComments: ["GET /gists/{gist_id}/comments"], + listCommits: ["GET /gists/{gist_id}/commits"], + listForUser: ["GET /users/{username}/gists"], + listForks: ["GET /gists/{gist_id}/forks"], + listPublic: ["GET /gists/public"], + listStarred: ["GET /gists/starred"], + star: ["PUT /gists/{gist_id}/star"], + unstar: ["DELETE /gists/{gist_id}/star"], + update: ["PATCH /gists/{gist_id}"], + updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"] + }, + git: { + createBlob: ["POST /repos/{owner}/{repo}/git/blobs"], + createCommit: ["POST /repos/{owner}/{repo}/git/commits"], + createRef: ["POST /repos/{owner}/{repo}/git/refs"], + createTag: ["POST /repos/{owner}/{repo}/git/tags"], + createTree: ["POST /repos/{owner}/{repo}/git/trees"], + deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"], + getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"], + getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"], + getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"], + getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"], + getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"], + listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"], + updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"] + }, + gitignore: { + getAllTemplates: ["GET /gitignore/templates"], + getTemplate: ["GET /gitignore/templates/{name}"] + }, + interactions: { + getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"], + getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"], + getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"], + getRestrictionsForYourPublicRepos: ["GET /user/interaction-limits", {}, { + renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] + }], + removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"], + removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"], + removeRestrictionsForRepo: ["DELETE /repos/{owner}/{repo}/interaction-limits"], + removeRestrictionsForYourPublicRepos: ["DELETE /user/interaction-limits", {}, { + renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] + }], + setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"], + setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"], + setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"], + setRestrictionsForYourPublicRepos: ["PUT /user/interaction-limits", {}, { + renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] + }] + }, + issues: { + addAssignees: ["POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"], + checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"], + create: ["POST /repos/{owner}/{repo}/issues"], + createComment: ["POST /repos/{owner}/{repo}/issues/{issue_number}/comments"], + createLabel: ["POST /repos/{owner}/{repo}/labels"], + createMilestone: ["POST /repos/{owner}/{repo}/milestones"], + deleteComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"], + deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"], + deleteMilestone: ["DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"], + get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"], + getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"], + getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"], + getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"], + getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"], + list: ["GET /issues"], + listAssignees: ["GET /repos/{owner}/{repo}/assignees"], + listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"], + listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"], + listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"], + listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"], + listEventsForTimeline: ["GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"], + listForAuthenticatedUser: ["GET /user/issues"], + listForOrg: ["GET /orgs/{org}/issues"], + listForRepo: ["GET /repos/{owner}/{repo}/issues"], + listLabelsForMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"], + listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"], + listLabelsOnIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/labels"], + listMilestones: ["GET /repos/{owner}/{repo}/milestones"], + lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"], + removeAllLabels: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"], + removeAssignees: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + removeLabel: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"], + setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"], + unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"], + update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"], + updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"], + updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"], + updateMilestone: ["PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"] + }, + licenses: { + get: ["GET /licenses/{license}"], + getAllCommonlyUsed: ["GET /licenses"], + getForRepo: ["GET /repos/{owner}/{repo}/license"] + }, + markdown: { + render: ["POST /markdown"], + renderRaw: ["POST /markdown/raw", { + headers: { + "content-type": "text/plain; charset=utf-8" + } + }] + }, + meta: { + get: ["GET /meta"], + getOctocat: ["GET /octocat"], + getZen: ["GET /zen"], + root: ["GET /"] + }, + migrations: { + cancelImport: ["DELETE /repos/{owner}/{repo}/import"], + deleteArchiveForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/archive"], + deleteArchiveForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/archive"], + downloadArchiveForOrg: ["GET /orgs/{org}/migrations/{migration_id}/archive"], + getArchiveForAuthenticatedUser: ["GET /user/migrations/{migration_id}/archive"], + getCommitAuthors: ["GET /repos/{owner}/{repo}/import/authors"], + getImportStatus: ["GET /repos/{owner}/{repo}/import"], + getLargeFiles: ["GET /repos/{owner}/{repo}/import/large_files"], + getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"], + getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"], + listForAuthenticatedUser: ["GET /user/migrations"], + listForOrg: ["GET /orgs/{org}/migrations"], + listReposForAuthenticatedUser: ["GET /user/migrations/{migration_id}/repositories"], + listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"], + listReposForUser: ["GET /user/migrations/{migration_id}/repositories", {}, { + renamed: ["migrations", "listReposForAuthenticatedUser"] + }], + mapCommitAuthor: ["PATCH /repos/{owner}/{repo}/import/authors/{author_id}"], + setLfsPreference: ["PATCH /repos/{owner}/{repo}/import/lfs"], + startForAuthenticatedUser: ["POST /user/migrations"], + startForOrg: ["POST /orgs/{org}/migrations"], + startImport: ["PUT /repos/{owner}/{repo}/import"], + unlockRepoForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"], + unlockRepoForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"], + updateImport: ["PATCH /repos/{owner}/{repo}/import"] + }, + orgs: { + blockUser: ["PUT /orgs/{org}/blocks/{username}"], + cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], + checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], + checkMembershipForUser: ["GET /orgs/{org}/members/{username}"], + checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"], + convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"], + createInvitation: ["POST /orgs/{org}/invitations"], + createWebhook: ["POST /orgs/{org}/hooks"], + deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], + get: ["GET /orgs/{org}"], + getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], + getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], + getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], + getWebhookDelivery: ["GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"], + list: ["GET /organizations"], + listAppInstallations: ["GET /orgs/{org}/installations"], + listBlockedUsers: ["GET /orgs/{org}/blocks"], + listCustomRoles: ["GET /organizations/{organization_id}/custom_roles"], + listFailedInvitations: ["GET /orgs/{org}/failed_invitations"], + listForAuthenticatedUser: ["GET /user/orgs"], + listForUser: ["GET /users/{username}/orgs"], + listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], + listMembers: ["GET /orgs/{org}/members"], + listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], + listPendingInvitations: ["GET /orgs/{org}/invitations"], + listPublicMembers: ["GET /orgs/{org}/public_members"], + listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], + listWebhooks: ["GET /orgs/{org}/hooks"], + pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], + redeliverWebhookDelivery: ["POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"], + removeMember: ["DELETE /orgs/{org}/members/{username}"], + removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"], + removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"], + removePublicMembershipForAuthenticatedUser: ["DELETE /orgs/{org}/public_members/{username}"], + setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], + setPublicMembershipForAuthenticatedUser: ["PUT /orgs/{org}/public_members/{username}"], + unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], + update: ["PATCH /orgs/{org}"], + updateMembershipForAuthenticatedUser: ["PATCH /user/memberships/orgs/{org}"], + updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"], + updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"] + }, + packages: { + deletePackageForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}"], + deletePackageForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}"], + deletePackageForUser: ["DELETE /users/{username}/packages/{package_type}/{package_name}"], + deletePackageVersionForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"], + deletePackageVersionForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + deletePackageVersionForUser: ["DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getAllPackageVersionsForAPackageOwnedByAnOrg: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions", {}, { + renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] + }], + getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions", {}, { + renamed: ["packages", "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"] + }], + getAllPackageVersionsForPackageOwnedByAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions"], + getAllPackageVersionsForPackageOwnedByOrg: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions"], + getAllPackageVersionsForPackageOwnedByUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions"], + getPackageForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}"], + getPackageForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}"], + getPackageForUser: ["GET /users/{username}/packages/{package_type}/{package_name}"], + getPackageVersionForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getPackageVersionForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getPackageVersionForUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + listPackagesForAuthenticatedUser: ["GET /user/packages"], + listPackagesForOrganization: ["GET /orgs/{org}/packages"], + listPackagesForUser: ["GET /users/{username}/packages"], + restorePackageForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageForUser: ["POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageVersionForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"], + restorePackageVersionForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"], + restorePackageVersionForUser: ["POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"] + }, + projects: { + addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}"], + createCard: ["POST /projects/columns/{column_id}/cards"], + createColumn: ["POST /projects/{project_id}/columns"], + createForAuthenticatedUser: ["POST /user/projects"], + createForOrg: ["POST /orgs/{org}/projects"], + createForRepo: ["POST /repos/{owner}/{repo}/projects"], + delete: ["DELETE /projects/{project_id}"], + deleteCard: ["DELETE /projects/columns/cards/{card_id}"], + deleteColumn: ["DELETE /projects/columns/{column_id}"], + get: ["GET /projects/{project_id}"], + getCard: ["GET /projects/columns/cards/{card_id}"], + getColumn: ["GET /projects/columns/{column_id}"], + getPermissionForUser: ["GET /projects/{project_id}/collaborators/{username}/permission"], + listCards: ["GET /projects/columns/{column_id}/cards"], + listCollaborators: ["GET /projects/{project_id}/collaborators"], + listColumns: ["GET /projects/{project_id}/columns"], + listForOrg: ["GET /orgs/{org}/projects"], + listForRepo: ["GET /repos/{owner}/{repo}/projects"], + listForUser: ["GET /users/{username}/projects"], + moveCard: ["POST /projects/columns/cards/{card_id}/moves"], + moveColumn: ["POST /projects/columns/{column_id}/moves"], + removeCollaborator: ["DELETE /projects/{project_id}/collaborators/{username}"], + update: ["PATCH /projects/{project_id}"], + updateCard: ["PATCH /projects/columns/cards/{card_id}"], + updateColumn: ["PATCH /projects/columns/{column_id}"] + }, + pulls: { + checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + create: ["POST /repos/{owner}/{repo}/pulls"], + createReplyForReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"], + createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + createReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + deletePendingReview: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + deleteReviewComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + dismissReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"], + get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"], + getReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + list: ["GET /repos/{owner}/{repo}/pulls"], + listCommentsForReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"], + listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"], + listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"], + listRequestedReviewers: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + listReviewComments: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"], + listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + removeRequestedReviewers: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + requestReviewers: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + submitReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"], + update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"], + updateBranch: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"], + updateReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + updateReviewComment: ["PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"] + }, + rateLimit: { + get: ["GET /rate_limit"] + }, + reactions: { + createForCommitComment: ["POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"], + createForIssue: ["POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"], + createForIssueComment: ["POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"], + createForPullRequestReviewComment: ["POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"], + createForRelease: ["POST /repos/{owner}/{repo}/releases/{release_id}/reactions"], + createForTeamDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"], + createForTeamDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"], + deleteForCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"], + deleteForIssue: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"], + deleteForIssueComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"], + deleteForPullRequestComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"], + deleteForRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"], + deleteForTeamDiscussion: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"], + deleteForTeamDiscussionComment: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"], + listForCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"], + listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"], + listForIssueComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"], + listForPullRequestReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"], + listForRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}/reactions"], + listForTeamDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"], + listForTeamDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"] + }, + repos: { + acceptInvitation: ["PATCH /user/repository_invitations/{invitation_id}", {}, { + renamed: ["repos", "acceptInvitationForAuthenticatedUser"] + }], + acceptInvitationForAuthenticatedUser: ["PATCH /user/repository_invitations/{invitation_id}"], + addAppAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"], + addStatusCheckContexts: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + addTeamAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + addUserAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"], + checkVulnerabilityAlerts: ["GET /repos/{owner}/{repo}/vulnerability-alerts"], + codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"], + compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"], + compareCommitsWithBasehead: ["GET /repos/{owner}/{repo}/compare/{basehead}"], + createAutolink: ["POST /repos/{owner}/{repo}/autolinks"], + createCommitComment: ["POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + createCommitSignatureProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"], + createDeployKey: ["POST /repos/{owner}/{repo}/keys"], + createDeployment: ["POST /repos/{owner}/{repo}/deployments"], + createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"], + createForAuthenticatedUser: ["POST /user/repos"], + createFork: ["POST /repos/{owner}/{repo}/forks"], + createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateEnvironment: ["PUT /repos/{owner}/{repo}/environments/{environment_name}"], + createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], + createPagesSite: ["POST /repos/{owner}/{repo}/pages"], + createRelease: ["POST /repos/{owner}/{repo}/releases"], + createTagProtection: ["POST /repos/{owner}/{repo}/tags/protection"], + createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate"], + createWebhook: ["POST /repos/{owner}/{repo}/hooks"], + declineInvitation: ["DELETE /user/repository_invitations/{invitation_id}", {}, { + renamed: ["repos", "declineInvitationForAuthenticatedUser"] + }], + declineInvitationForAuthenticatedUser: ["DELETE /user/repository_invitations/{invitation_id}"], + delete: ["DELETE /repos/{owner}/{repo}"], + deleteAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + deleteAdminBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + deleteAnEnvironment: ["DELETE /repos/{owner}/{repo}/environments/{environment_name}"], + deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"], + deleteBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection"], + deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"], + deleteCommitSignatureProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"], + deleteDeployment: ["DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"], + deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"], + deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"], + deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"], + deletePullRequestReviewProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"], + deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"], + deleteTagProtection: ["DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}"], + deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"], + disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes"], + disableLfsForRepo: ["DELETE /repos/{owner}/{repo}/lfs"], + disableVulnerabilityAlerts: ["DELETE /repos/{owner}/{repo}/vulnerability-alerts"], + downloadArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}", {}, { + renamed: ["repos", "downloadZipballArchive"] + }], + downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"], + downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"], + enableAutomatedSecurityFixes: ["PUT /repos/{owner}/{repo}/automated-security-fixes"], + enableLfsForRepo: ["PUT /repos/{owner}/{repo}/lfs"], + enableVulnerabilityAlerts: ["PUT /repos/{owner}/{repo}/vulnerability-alerts"], + generateReleaseNotes: ["POST /repos/{owner}/{repo}/releases/generate-notes"], + get: ["GET /repos/{owner}/{repo}"], + getAccessRestrictions: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + getAdminBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"], + getAllStatusCheckContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"], + getAllTopics: ["GET /repos/{owner}/{repo}/topics"], + getAppsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"], + getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"], + getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], + getBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection"], + getClones: ["GET /repos/{owner}/{repo}/traffic/clones"], + getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"], + getCollaboratorPermissionLevel: ["GET /repos/{owner}/{repo}/collaborators/{username}/permission"], + getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"], + getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"], + getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"], + getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"], + getCommitSignatureProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"], + getContent: ["GET /repos/{owner}/{repo}/contents/{path}"], + getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"], + getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"], + getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"], + getDeploymentStatus: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"], + getEnvironment: ["GET /repos/{owner}/{repo}/environments/{environment_name}"], + getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"], + getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"], + getPages: ["GET /repos/{owner}/{repo}/pages"], + getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], + getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], + getPullRequestReviewProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"], + getReadme: ["GET /repos/{owner}/{repo}/readme"], + getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"], + getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"], + getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"], + getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"], + getStatusChecksProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + getTeamsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"], + getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"], + getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"], + getUsersWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"], + getViews: ["GET /repos/{owner}/{repo}/traffic/views"], + getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"], + getWebhookConfigForRepo: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/config"], + getWebhookDelivery: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"], + listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"], + listBranches: ["GET /repos/{owner}/{repo}/branches"], + listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"], + listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"], + listCommentsForCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"], + listCommitStatusesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/statuses"], + listCommits: ["GET /repos/{owner}/{repo}/commits"], + listContributors: ["GET /repos/{owner}/{repo}/contributors"], + listDeployKeys: ["GET /repos/{owner}/{repo}/keys"], + listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + listDeployments: ["GET /repos/{owner}/{repo}/deployments"], + listForAuthenticatedUser: ["GET /user/repos"], + listForOrg: ["GET /orgs/{org}/repos"], + listForUser: ["GET /users/{username}/repos"], + listForks: ["GET /repos/{owner}/{repo}/forks"], + listInvitations: ["GET /repos/{owner}/{repo}/invitations"], + listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"], + listLanguages: ["GET /repos/{owner}/{repo}/languages"], + listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"], + listPublic: ["GET /repositories"], + listPullRequestsAssociatedWithCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"], + listReleaseAssets: ["GET /repos/{owner}/{repo}/releases/{release_id}/assets"], + listReleases: ["GET /repos/{owner}/{repo}/releases"], + listTagProtection: ["GET /repos/{owner}/{repo}/tags/protection"], + listTags: ["GET /repos/{owner}/{repo}/tags"], + listTeams: ["GET /repos/{owner}/{repo}/teams"], + listWebhookDeliveries: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"], + listWebhooks: ["GET /repos/{owner}/{repo}/hooks"], + merge: ["POST /repos/{owner}/{repo}/merges"], + mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"], + pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"], + redeliverWebhookDelivery: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"], + removeAppAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + removeCollaborator: ["DELETE /repos/{owner}/{repo}/collaborators/{username}"], + removeStatusCheckContexts: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + removeStatusCheckProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + removeTeamAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + removeUserAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"], + replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"], + requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"], + setAdminBranchProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + setAppAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + setStatusCheckContexts: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + setTeamAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + setUserAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"], + transfer: ["POST /repos/{owner}/{repo}/transfer"], + update: ["PATCH /repos/{owner}/{repo}"], + updateBranchProtection: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection"], + updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"], + updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"], + updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"], + updatePullRequestReviewProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"], + updateReleaseAsset: ["PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"], + updateStatusCheckPotection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks", {}, { + renamed: ["repos", "updateStatusCheckProtection"] + }], + updateStatusCheckProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"], + updateWebhookConfigForRepo: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"], + uploadReleaseAsset: ["POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}", { + baseUrl: "https://uploads.github.com" + }] + }, + search: { + code: ["GET /search/code"], + commits: ["GET /search/commits"], + issuesAndPullRequests: ["GET /search/issues"], + labels: ["GET /search/labels"], + repos: ["GET /search/repositories"], + topics: ["GET /search/topics"], + users: ["GET /search/users"] + }, + secretScanning: { + getAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"], + listAlertsForEnterprise: ["GET /enterprises/{enterprise}/secret-scanning/alerts"], + listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"], + listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"], + listLocationsForAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"], + updateAlert: ["PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"] + }, + teams: { + addOrUpdateMembershipForUserInOrg: ["PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"], + addOrUpdateProjectPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + addOrUpdateRepoPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + checkPermissionsForProjectInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + checkPermissionsForRepoInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + create: ["POST /orgs/{org}/teams"], + createDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"], + deleteDiscussionCommentInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + deleteDiscussionInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"], + getByName: ["GET /orgs/{org}/teams/{team_slug}"], + getDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + getDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + getMembershipForUserInOrg: ["GET /orgs/{org}/teams/{team_slug}/memberships/{username}"], + list: ["GET /orgs/{org}/teams"], + listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"], + listDiscussionCommentsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"], + listForAuthenticatedUser: ["GET /user/teams"], + listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"], + listPendingInvitationsInOrg: ["GET /orgs/{org}/teams/{team_slug}/invitations"], + listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects"], + listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"], + removeMembershipForUserInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"], + removeProjectInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + removeRepoInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + updateDiscussionCommentInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + updateDiscussionInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"] + }, + users: { + addEmailForAuthenticated: ["POST /user/emails", {}, { + renamed: ["users", "addEmailForAuthenticatedUser"] + }], + addEmailForAuthenticatedUser: ["POST /user/emails"], + block: ["PUT /user/blocks/{username}"], + checkBlocked: ["GET /user/blocks/{username}"], + checkFollowingForUser: ["GET /users/{username}/following/{target_user}"], + checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"], + createGpgKeyForAuthenticated: ["POST /user/gpg_keys", {}, { + renamed: ["users", "createGpgKeyForAuthenticatedUser"] + }], + createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"], + createPublicSshKeyForAuthenticated: ["POST /user/keys", {}, { + renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] + }], + createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"], + deleteEmailForAuthenticated: ["DELETE /user/emails", {}, { + renamed: ["users", "deleteEmailForAuthenticatedUser"] + }], + deleteEmailForAuthenticatedUser: ["DELETE /user/emails"], + deleteGpgKeyForAuthenticated: ["DELETE /user/gpg_keys/{gpg_key_id}", {}, { + renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] + }], + deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"], + deletePublicSshKeyForAuthenticated: ["DELETE /user/keys/{key_id}", {}, { + renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] + }], + deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"], + follow: ["PUT /user/following/{username}"], + getAuthenticated: ["GET /user"], + getByUsername: ["GET /users/{username}"], + getContextForUser: ["GET /users/{username}/hovercard"], + getGpgKeyForAuthenticated: ["GET /user/gpg_keys/{gpg_key_id}", {}, { + renamed: ["users", "getGpgKeyForAuthenticatedUser"] + }], + getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"], + getPublicSshKeyForAuthenticated: ["GET /user/keys/{key_id}", {}, { + renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] + }], + getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"], + list: ["GET /users"], + listBlockedByAuthenticated: ["GET /user/blocks", {}, { + renamed: ["users", "listBlockedByAuthenticatedUser"] + }], + listBlockedByAuthenticatedUser: ["GET /user/blocks"], + listEmailsForAuthenticated: ["GET /user/emails", {}, { + renamed: ["users", "listEmailsForAuthenticatedUser"] + }], + listEmailsForAuthenticatedUser: ["GET /user/emails"], + listFollowedByAuthenticated: ["GET /user/following", {}, { + renamed: ["users", "listFollowedByAuthenticatedUser"] + }], + listFollowedByAuthenticatedUser: ["GET /user/following"], + listFollowersForAuthenticatedUser: ["GET /user/followers"], + listFollowersForUser: ["GET /users/{username}/followers"], + listFollowingForUser: ["GET /users/{username}/following"], + listGpgKeysForAuthenticated: ["GET /user/gpg_keys", {}, { + renamed: ["users", "listGpgKeysForAuthenticatedUser"] + }], + listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"], + listGpgKeysForUser: ["GET /users/{username}/gpg_keys"], + listPublicEmailsForAuthenticated: ["GET /user/public_emails", {}, { + renamed: ["users", "listPublicEmailsForAuthenticatedUser"] + }], + listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"], + listPublicKeysForUser: ["GET /users/{username}/keys"], + listPublicSshKeysForAuthenticated: ["GET /user/keys", {}, { + renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] + }], + listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"], + setPrimaryEmailVisibilityForAuthenticated: ["PATCH /user/email/visibility", {}, { + renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] + }], + setPrimaryEmailVisibilityForAuthenticatedUser: ["PATCH /user/email/visibility"], + unblock: ["DELETE /user/blocks/{username}"], + unfollow: ["DELETE /user/following/{username}"], + updateAuthenticated: ["PATCH /user"] + } +}; + +const VERSION = "5.16.2"; + +function endpointsToMethods(octokit, endpointsMap) { + const newMethods = {}; + + for (const [scope, endpoints] of Object.entries(endpointsMap)) { + for (const [methodName, endpoint] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint; + const [method, url] = route.split(/ /); + const endpointDefaults = Object.assign({ + method, + url + }, defaults); + + if (!newMethods[scope]) { + newMethods[scope] = {}; + } + + const scopeMethods = newMethods[scope]; + + if (decorations) { + scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); + continue; + } + + scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); + } + } + + return newMethods; +} + +function decorate(octokit, scope, methodName, defaults, decorations) { + const requestWithDefaults = octokit.request.defaults(defaults); + /* istanbul ignore next */ + + function withDecorations(...args) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` + + if (decorations.mapToData) { + options = Object.assign({}, options, { + data: options[decorations.mapToData], + [decorations.mapToData]: undefined + }); + return requestWithDefaults(options); + } + + if (decorations.renamed) { + const [newScope, newMethodName] = decorations.renamed; + octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`); + } + + if (decorations.deprecated) { + octokit.log.warn(decorations.deprecated); + } + + if (decorations.renamedParameters) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + const options = requestWithDefaults.endpoint.merge(...args); + + for (const [name, alias] of Object.entries(decorations.renamedParameters)) { + if (name in options) { + octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`); + + if (!(alias in options)) { + options[alias] = options[name]; + } + + delete options[name]; + } + } + + return requestWithDefaults(options); + } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + + + return requestWithDefaults(...args); + } + + return Object.assign(withDecorations, requestWithDefaults); +} + +function restEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return { + rest: api + }; +} +restEndpointMethods.VERSION = VERSION; +function legacyRestEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return _objectSpread2(_objectSpread2({}, api), {}, { + rest: api + }); +} +legacyRestEndpointMethods.VERSION = VERSION; + +exports.legacyRestEndpointMethods = legacyRestEndpointMethods; +exports.restEndpointMethods = restEndpointMethods; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ 537: @@ -66997,6 +69221,7 @@ const constants = __importStar(__nccwpck_require__(9042)); const cache_1 = __nccwpck_require__(4810); const reports_1 = __nccwpck_require__(94); const options_1 = __nccwpck_require__(6159); +const utils_1 = __nccwpck_require__(1314); /** * Check given input and run a save process for the specified package manager * @returns Promise that will be resolved when the save process finishes @@ -67027,11 +69252,19 @@ function ignoreError(promise) { }); } function run() { + return __awaiter(this, void 0, void 0, function* () { + yield outputReports(); + yield ignoreError(saveCache()); + }); +} +exports.run = run; +function outputReports() { return __awaiter(this, void 0, void 0, function* () { let reported = false; if (yield options_1.isNativeImageBuildReport()) { const report = yield reports_1.createNIBuildReport(); if (options_1.isPrReport()) { + utils_1.commentPR(report); } if (options_1.isJobReport()) { core.summary.addRaw(report); @@ -67041,6 +69274,7 @@ function run() { if (yield options_1.isNativeImageArtifactReport()) { const report = reports_1.createNIArtifactReport(); if (options_1.isPrReport()) { + utils_1.commentPR(report); } if (options_1.isJobReport()) { core.summary.addRaw(report); @@ -67049,10 +69283,8 @@ function run() { } if (reported) core.summary.write(); - yield ignoreError(saveCache()); }); } -exports.run = run; if (require.main === require.cache[eval('__filename')]) { run(); } @@ -67070,7 +69302,7 @@ else { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.NATIVE_IMAGE_OPTIONS_FILE = exports.ENV_NATIVE_IMAGE_CONFIG_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -67095,7 +69327,10 @@ exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : ''; exports.MANDREL_NAMESPACE = 'mandrel-'; exports.GDS_BASE = 'https://gds.oracle.com/api/20220101'; exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'; +exports.ENV_NATIVE_IMAGE_CONFIG_FILE = 'NATIVE_IMAGE_CONFIG_FILE'; exports.NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties'; +exports.ENV_GITHUB_EVENT_NAME = "GITHUB_EVENT_NAME"; +exports.EVENT_NAME_PULL_REQUEST = "pull_request"; function determineGraalVMArchitecture() { switch (process.arch) { case 'x64': { @@ -67224,8 +69459,11 @@ function setUpGUComponents(gdsToken, graalVMHome, components) { }); } exports.setUpGUComponents = setUpGUComponents; +let version; function getVersionString() { return __awaiter(this, void 0, void 0, function* () { + if (version) + return version; let output = ""; const options = { listeners: { @@ -67236,7 +69474,7 @@ function getVersionString() { }; yield utils_1.exec('gu', ['--version'], options); const versionParts = output.split(' '); - return versionParts[versionParts.length - 1]; + return version = versionParts[versionParts.length - 1]; }); } exports.getVersionString = getVersionString; @@ -67386,7 +69624,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; +exports.getGitHubToken = exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrEvent = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; const core = __importStar(__nccwpck_require__(2186)); const c = __importStar(__nccwpck_require__(9042)); const utils_1 = __nccwpck_require__(1314); @@ -67403,9 +69641,13 @@ function isJobReport() { } exports.isJobReport = isJobReport; function isPrReport() { - return core.getBooleanInput(c.INPUT_NI_REPORT_PR); + return isPrEvent() && core.getBooleanInput(c.INPUT_NI_REPORT_PR); } exports.isPrReport = isPrReport; +function isPrEvent() { + return process.env[c.ENV_GITHUB_EVENT_NAME] === c.EVENT_NAME_PULL_REQUEST; +} +exports.isPrEvent = isPrEvent; function isNativeImageArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); @@ -67418,6 +69660,10 @@ function isArtReport() { return false; //core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); } exports.isArtReport = isArtReport; +function getGitHubToken() { + return core.getInput(c.INPUT_GITHUB_TOKEN); +} +exports.getGitHubToken = getGitHubToken; /***/ }), @@ -67483,7 +69729,7 @@ exports.setUpNIBuildReport = setUpNIBuildReport; const descend = (v1, v2) => v2.size - v1.size; const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { - let out = ""; + let out = mark.header("Native Image Artifact Report", 1); const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; @@ -67516,7 +69762,8 @@ function packagesToTable(pkgs) { function createNIBuildReport() { return __awaiter(this, void 0, void 0, function* () { const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); - let out = mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); + let out = mark.header("Native Image Build Output Report", 1); + out += mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${yield gu.getVersionString()}`; out += mark.header("Analysis Results", 4); out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Classes", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Fields", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Methods", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }), ...analysisResultsToTableRows(data[buildOutputDef_1.ANALYSIS_RESULTS])); @@ -67698,7 +69945,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +exports.commentPR = exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; const c = __importStar(__nccwpck_require__(9042)); const gu_1 = __nccwpck_require__(5609); const core = __importStar(__nccwpck_require__(2186)); @@ -67710,6 +69957,8 @@ const core_1 = __nccwpck_require__(6762); const crypto_1 = __nccwpck_require__(6113); const path_1 = __nccwpck_require__(1017); const fs = __importStar(__nccwpck_require__(7147)); +const github = __importStar(__nccwpck_require__(5438)); +const options_1 = __nccwpck_require__(6159); // Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'; const GitHub = core_1.Octokit.defaults({ @@ -67731,7 +69980,7 @@ function exec(commandLine, args, options) { exports.exec = exec; function getLatestRelease(repo) { return __awaiter(this, void 0, void 0, function* () { - const githubToken = core.getInput('github-token'); + const githubToken = options_1.getGitHubToken(); const options = githubToken.length > 0 ? { auth: githubToken } : {}; const octokit = new GitHub(options); return (yield octokit.request('GET /repos/{owner}/{repo}/releases/latest', { @@ -67804,9 +70053,9 @@ function toSemVer(version) { return `${major}.${minor}.${patch}`; } function getNativeImageOptionsFile() { - let optionsFile = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + let optionsFile = process.env[c.ENV_NATIVE_IMAGE_CONFIG_FILE]; if (optionsFile === undefined) - core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + core.exportVariable(c.ENV_NATIVE_IMAGE_CONFIG_FILE, optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); return optionsFile; } function setNativeImageOption(value) { @@ -67846,6 +70095,16 @@ function hRBytes(bytes, decimals = 2) { return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } exports.hRBytes = hRBytes; +function commentPR(content) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + if (!options_1.isPrEvent()) + throw new Error("Not a PR event."); + const context = github.context; + yield github.getOctokit(options_1.getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content })); + }); +} +exports.commentPR = commentPR; /***/ }), diff --git a/dist/main/index.js b/dist/main/index.js index 8d6f514..08b29b8 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -5819,6 +5819,902 @@ class ExecState extends events.EventEmitter { /***/ }), +/***/ 4087: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Context = void 0; +const fs_1 = __nccwpck_require__(7147); +const os_1 = __nccwpck_require__(2037); +class Context { + /** + * Hydrate the context from the environment + */ + constructor() { + var _a, _b, _c; + this.payload = {}; + if (process.env.GITHUB_EVENT_PATH) { + if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) { + this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' })); + } + else { + const path = process.env.GITHUB_EVENT_PATH; + process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`); + } + } + this.eventName = process.env.GITHUB_EVENT_NAME; + this.sha = process.env.GITHUB_SHA; + this.ref = process.env.GITHUB_REF; + this.workflow = process.env.GITHUB_WORKFLOW; + this.action = process.env.GITHUB_ACTION; + this.actor = process.env.GITHUB_ACTOR; + this.job = process.env.GITHUB_JOB; + this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10); + this.runId = parseInt(process.env.GITHUB_RUN_ID, 10); + this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`; + this.serverUrl = (_b = process.env.GITHUB_SERVER_URL) !== null && _b !== void 0 ? _b : `https://github.com`; + this.graphqlUrl = (_c = process.env.GITHUB_GRAPHQL_URL) !== null && _c !== void 0 ? _c : `https://api.github.com/graphql`; + } + get issue() { + const payload = this.payload; + return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number }); + } + get repo() { + if (process.env.GITHUB_REPOSITORY) { + const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); + return { owner, repo }; + } + if (this.payload.repository) { + return { + owner: this.payload.repository.owner.login, + repo: this.payload.repository.name + }; + } + throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'"); + } +} +exports.Context = Context; +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 5438: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getOctokit = exports.context = void 0; +const Context = __importStar(__nccwpck_require__(4087)); +const utils_1 = __nccwpck_require__(3030); +exports.context = new Context.Context(); +/** + * Returns a hydrated octokit ready to use for GitHub Actions + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokit(token, options, ...additionalPlugins) { + const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins); + return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options)); +} +exports.getOctokit = getOctokit; +//# sourceMappingURL=github.js.map + +/***/ }), + +/***/ 7914: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0; +const httpClient = __importStar(__nccwpck_require__(6341)); +function getAuthString(token, options) { + if (!token && !options.auth) { + throw new Error('Parameter token or opts.auth is required'); + } + else if (token && options.auth) { + throw new Error('Parameters token and opts.auth may not both be specified'); + } + return typeof options.auth === 'string' ? options.auth : `token ${token}`; +} +exports.getAuthString = getAuthString; +function getProxyAgent(destinationUrl) { + const hc = new httpClient.HttpClient(); + return hc.getAgent(destinationUrl); +} +exports.getProxyAgent = getProxyAgent; +function getApiBaseUrl() { + return process.env['GITHUB_API_URL'] || 'https://api.github.com'; +} +exports.getApiBaseUrl = getApiBaseUrl; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 3030: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0; +const Context = __importStar(__nccwpck_require__(4087)); +const Utils = __importStar(__nccwpck_require__(7914)); +// octokit + plugins +const core_1 = __nccwpck_require__(6762); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044); +const plugin_paginate_rest_1 = __nccwpck_require__(4193); +exports.context = new Context.Context(); +const baseUrl = Utils.getApiBaseUrl(); +exports.defaults = { + baseUrl, + request: { + agent: Utils.getProxyAgent(baseUrl) + } +}; +exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults); +/** + * Convience function to correctly format Octokit Options to pass into the constructor. + * + * @param token the repo PAT or GITHUB_TOKEN + * @param options other options to set + */ +function getOctokitOptions(token, options) { + const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller + // Auth + const auth = Utils.getAuthString(token, opts); + if (auth) { + opts.auth = auth; + } + return opts; +} +exports.getOctokitOptions = getOctokitOptions; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 6341: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; +const http = __importStar(__nccwpck_require__(3685)); +const https = __importStar(__nccwpck_require__(5687)); +const pm = __importStar(__nccwpck_require__(3466)); +const tunnel = __importStar(__nccwpck_require__(4294)); +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + })); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + const parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + }); + } + get(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + }); + } + del(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + }); + } + post(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + }); + } + patch(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + }); + } + put(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + }); + } + head(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + }); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request(verb, requestUrl, stream, additionalHeaders); + }); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + getJson(requestUrl, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + const res = yield this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + postJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + putJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + patchJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + const parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + do { + response = yield this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (const handler of this.handlers) { + if (handler.canHandleAuthentication(response)) { + authenticationHandler = handler; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (response.message.statusCode && + HttpRedirectCodes.includes(response.message.statusCode) && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + const parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol === 'https:' && + parsedUrl.protocol !== parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + yield response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (const header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (!response.message.statusCode || + !HttpResponseRetryCodes.includes(response.message.statusCode)) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } while (numTries < maxTries); + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + function callbackForResult(err, res) { + if (err) { + reject(err); + } + else if (!res) { + // If `err` is not passed, then `res` must be passed. + reject(new Error('Unknown error')); + } + else { + resolve(res); + } + } + this.requestRawWithCallback(info, data, callbackForResult); + }); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + if (typeof data === 'string') { + if (!info.options.headers) { + info.options.headers = {}; + } + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + function handleResult(err, res) { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + } + const req = info.httpModule.request(info.options, (msg) => { + const res = new HttpClientResponse(msg); + handleResult(undefined, res); + }); + let socket; + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); + } + handleResult(new Error(`Request timeout: ${info.options.path}`)); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + const parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + for (const handler of this.handlers) { + handler.prepareRequest(info.options); + } + } + return info; + } + _mergeHeaders(headers) { + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. + if (proxyUrl && proxyUrl.hostname) { + const agentOptions = { + maxSockets, + keepAlive: this._keepAlive, + proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` + })), { host: proxyUrl.hostname, port: proxyUrl.port }) + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + return __awaiter(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 __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const statusCode = res.message.statusCode || 0; + const response = { + statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode === HttpCodes.NotFound) { + resolve(response); + } + // get the result from the body + function dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + const a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + let obj; + let contents; + try { + contents = yield res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = `Failed request: (${statusCode})`; + } + const err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + })); + }); + } +} +exports.HttpClient = HttpClient; +const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 3466: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkBypass = exports.getProxyUrl = void 0; +function getProxyUrl(reqUrl) { + const usingSsl = reqUrl.protocol === 'https:'; + if (checkBypass(reqUrl)) { + return undefined; + } + 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) { + return new URL(proxyVar); + } + else { + return undefined; + } +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + const upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (const upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; +//# sourceMappingURL=proxy.js.map + +/***/ }), + /***/ 8090: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -46584,6 +47480,1334 @@ exports.withCustomRequest = withCustomRequest; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 4193: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const VERSION = "2.21.3"; + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +/** + * Some “list” response that can be paginated have a different response structure + * + * They have a `total_count` key in the response (search also has `incomplete_results`, + * /installation/repositories also has `repository_selection`), as well as a key with + * the list of the items which name varies from endpoint to endpoint. + * + * Octokit normalizes these responses so that paginated results are always returned following + * the same structure. One challenge is that if the list response has only one page, no Link + * header is provided, so this header alone is not sufficient to check wether a response is + * paginated or not. + * + * We check if a "total_count" key is present in the response data, but also make sure that + * a "url" property is not, as the "Get the combined status for a specific ref" endpoint would + * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + */ +function normalizePaginatedListResponse(response) { + // endpoints can respond with 204 if repository is empty + if (!response.data) { + return _objectSpread2(_objectSpread2({}, response), {}, { + data: [] + }); + } + + const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data); + if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way + // to retrieve the same information. + + const incompleteResults = response.data.incomplete_results; + const repositorySelection = response.data.repository_selection; + const totalCount = response.data.total_count; + delete response.data.incomplete_results; + delete response.data.repository_selection; + delete response.data.total_count; + const namespaceKey = Object.keys(response.data)[0]; + const data = response.data[namespaceKey]; + response.data = data; + + if (typeof incompleteResults !== "undefined") { + response.data.incomplete_results = incompleteResults; + } + + if (typeof repositorySelection !== "undefined") { + response.data.repository_selection = repositorySelection; + } + + response.data.total_count = totalCount; + return response; +} + +function iterator(octokit, route, parameters) { + const options = typeof route === "function" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters); + const requestMethod = typeof route === "function" ? route : octokit.request; + const method = options.method; + const headers = options.headers; + let url = options.url; + return { + [Symbol.asyncIterator]: () => ({ + async next() { + if (!url) return { + done: true + }; + + try { + const response = await requestMethod({ + method, + url, + headers + }); + const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format: + // '; rel="next", ; rel="last"' + // sets `url` to undefined if "next" URL is not present or `link` header is not set + + url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; + return { + value: normalizedResponse + }; + } catch (error) { + if (error.status !== 409) throw error; + url = ""; + return { + value: { + status: 200, + headers: {}, + data: [] + } + }; + } + } + + }) + }; +} + +function paginate(octokit, route, parameters, mapFn) { + if (typeof parameters === "function") { + mapFn = parameters; + parameters = undefined; + } + + return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); +} + +function gather(octokit, results, iterator, mapFn) { + return iterator.next().then(result => { + if (result.done) { + return results; + } + + let earlyExit = false; + + function done() { + earlyExit = true; + } + + results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); + + if (earlyExit) { + return results; + } + + return gather(octokit, results, iterator, mapFn); + }); +} + +const composePaginateRest = Object.assign(paginate, { + iterator +}); + +const paginatingEndpoints = ["GET /app/hook/deliveries", "GET /app/installations", "GET /applications/grants", "GET /authorizations", "GET /enterprises/{enterprise}/actions/permissions/organizations", "GET /enterprises/{enterprise}/actions/runner-groups", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations", "GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners", "GET /enterprises/{enterprise}/actions/runners", "GET /enterprises/{enterprise}/audit-log", "GET /enterprises/{enterprise}/secret-scanning/alerts", "GET /enterprises/{enterprise}/settings/billing/advanced-security", "GET /events", "GET /gists", "GET /gists/public", "GET /gists/starred", "GET /gists/{gist_id}/comments", "GET /gists/{gist_id}/commits", "GET /gists/{gist_id}/forks", "GET /installation/repositories", "GET /issues", "GET /licenses", "GET /marketplace_listing/plans", "GET /marketplace_listing/plans/{plan_id}/accounts", "GET /marketplace_listing/stubbed/plans", "GET /marketplace_listing/stubbed/plans/{plan_id}/accounts", "GET /networks/{owner}/{repo}/events", "GET /notifications", "GET /organizations", "GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/secrets", "GET /orgs/{org}/actions/secrets/{secret_name}/repositories", "GET /orgs/{org}/audit-log", "GET /orgs/{org}/blocks", "GET /orgs/{org}/code-scanning/alerts", "GET /orgs/{org}/codespaces", "GET /orgs/{org}/credential-authorizations", "GET /orgs/{org}/dependabot/secrets", "GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories", "GET /orgs/{org}/events", "GET /orgs/{org}/external-groups", "GET /orgs/{org}/failed_invitations", "GET /orgs/{org}/hooks", "GET /orgs/{org}/hooks/{hook_id}/deliveries", "GET /orgs/{org}/installations", "GET /orgs/{org}/invitations", "GET /orgs/{org}/invitations/{invitation_id}/teams", "GET /orgs/{org}/issues", "GET /orgs/{org}/members", "GET /orgs/{org}/migrations", "GET /orgs/{org}/migrations/{migration_id}/repositories", "GET /orgs/{org}/outside_collaborators", "GET /orgs/{org}/packages", "GET /orgs/{org}/packages/{package_type}/{package_name}/versions", "GET /orgs/{org}/projects", "GET /orgs/{org}/public_members", "GET /orgs/{org}/repos", "GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/settings/billing/advanced-security", "GET /orgs/{org}/team-sync/groups", "GET /orgs/{org}/teams", "GET /orgs/{org}/teams/{team_slug}/discussions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", "GET /orgs/{org}/teams/{team_slug}/invitations", "GET /orgs/{org}/teams/{team_slug}/members", "GET /orgs/{org}/teams/{team_slug}/projects", "GET /orgs/{org}/teams/{team_slug}/repos", "GET /orgs/{org}/teams/{team_slug}/teams", "GET /projects/columns/{column_id}/cards", "GET /projects/{project_id}/collaborators", "GET /projects/{project_id}/columns", "GET /repos/{owner}/{repo}/actions/artifacts", "GET /repos/{owner}/{repo}/actions/caches", "GET /repos/{owner}/{repo}/actions/runners", "GET /repos/{owner}/{repo}/actions/runs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs", "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs", "GET /repos/{owner}/{repo}/actions/secrets", "GET /repos/{owner}/{repo}/actions/workflows", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs", "GET /repos/{owner}/{repo}/assignees", "GET /repos/{owner}/{repo}/branches", "GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", "GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", "GET /repos/{owner}/{repo}/code-scanning/alerts", "GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", "GET /repos/{owner}/{repo}/code-scanning/analyses", "GET /repos/{owner}/{repo}/codespaces", "GET /repos/{owner}/{repo}/codespaces/devcontainers", "GET /repos/{owner}/{repo}/codespaces/secrets", "GET /repos/{owner}/{repo}/collaborators", "GET /repos/{owner}/{repo}/comments", "GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/commits", "GET /repos/{owner}/{repo}/commits/{commit_sha}/comments", "GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", "GET /repos/{owner}/{repo}/commits/{ref}/check-runs", "GET /repos/{owner}/{repo}/commits/{ref}/check-suites", "GET /repos/{owner}/{repo}/commits/{ref}/status", "GET /repos/{owner}/{repo}/commits/{ref}/statuses", "GET /repos/{owner}/{repo}/contributors", "GET /repos/{owner}/{repo}/dependabot/secrets", "GET /repos/{owner}/{repo}/deployments", "GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses", "GET /repos/{owner}/{repo}/environments", "GET /repos/{owner}/{repo}/events", "GET /repos/{owner}/{repo}/forks", "GET /repos/{owner}/{repo}/git/matching-refs/{ref}", "GET /repos/{owner}/{repo}/hooks", "GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries", "GET /repos/{owner}/{repo}/invitations", "GET /repos/{owner}/{repo}/issues", "GET /repos/{owner}/{repo}/issues/comments", "GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/issues/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/comments", "GET /repos/{owner}/{repo}/issues/{issue_number}/events", "GET /repos/{owner}/{repo}/issues/{issue_number}/labels", "GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", "GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", "GET /repos/{owner}/{repo}/keys", "GET /repos/{owner}/{repo}/labels", "GET /repos/{owner}/{repo}/milestones", "GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels", "GET /repos/{owner}/{repo}/notifications", "GET /repos/{owner}/{repo}/pages/builds", "GET /repos/{owner}/{repo}/projects", "GET /repos/{owner}/{repo}/pulls", "GET /repos/{owner}/{repo}/pulls/comments", "GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", "GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", "GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", "GET /repos/{owner}/{repo}/pulls/{pull_number}/files", "GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", "GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments", "GET /repos/{owner}/{repo}/releases", "GET /repos/{owner}/{repo}/releases/{release_id}/assets", "GET /repos/{owner}/{repo}/releases/{release_id}/reactions", "GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/stargazers", "GET /repos/{owner}/{repo}/subscribers", "GET /repos/{owner}/{repo}/tags", "GET /repos/{owner}/{repo}/teams", "GET /repos/{owner}/{repo}/topics", "GET /repositories", "GET /repositories/{repository_id}/environments/{environment_name}/secrets", "GET /search/code", "GET /search/commits", "GET /search/issues", "GET /search/labels", "GET /search/repositories", "GET /search/topics", "GET /search/users", "GET /teams/{team_id}/discussions", "GET /teams/{team_id}/discussions/{discussion_number}/comments", "GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions", "GET /teams/{team_id}/discussions/{discussion_number}/reactions", "GET /teams/{team_id}/invitations", "GET /teams/{team_id}/members", "GET /teams/{team_id}/projects", "GET /teams/{team_id}/repos", "GET /teams/{team_id}/teams", "GET /user/blocks", "GET /user/codespaces", "GET /user/codespaces/secrets", "GET /user/emails", "GET /user/followers", "GET /user/following", "GET /user/gpg_keys", "GET /user/installations", "GET /user/installations/{installation_id}/repositories", "GET /user/issues", "GET /user/keys", "GET /user/marketplace_purchases", "GET /user/marketplace_purchases/stubbed", "GET /user/memberships/orgs", "GET /user/migrations", "GET /user/migrations/{migration_id}/repositories", "GET /user/orgs", "GET /user/packages", "GET /user/packages/{package_type}/{package_name}/versions", "GET /user/public_emails", "GET /user/repos", "GET /user/repository_invitations", "GET /user/starred", "GET /user/subscriptions", "GET /user/teams", "GET /users", "GET /users/{username}/events", "GET /users/{username}/events/orgs/{org}", "GET /users/{username}/events/public", "GET /users/{username}/followers", "GET /users/{username}/following", "GET /users/{username}/gists", "GET /users/{username}/gpg_keys", "GET /users/{username}/keys", "GET /users/{username}/orgs", "GET /users/{username}/packages", "GET /users/{username}/projects", "GET /users/{username}/received_events", "GET /users/{username}/received_events/public", "GET /users/{username}/repos", "GET /users/{username}/starred", "GET /users/{username}/subscriptions"]; + +function isPaginatingEndpoint(arg) { + if (typeof arg === "string") { + return paginatingEndpoints.includes(arg); + } else { + return false; + } +} + +/** + * @param octokit Octokit instance + * @param options Options passed to Octokit constructor + */ + +function paginateRest(octokit) { + return { + paginate: Object.assign(paginate.bind(null, octokit), { + iterator: iterator.bind(null, octokit) + }) + }; +} +paginateRest.VERSION = VERSION; + +exports.composePaginateRest = composePaginateRest; +exports.isPaginatingEndpoint = isPaginatingEndpoint; +exports.paginateRest = paginateRest; +exports.paginatingEndpoints = paginatingEndpoints; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 3044: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +const Endpoints = { + actions: { + addCustomLabelsToSelfHostedRunnerForOrg: ["POST /orgs/{org}/actions/runners/{runner_id}/labels"], + addCustomLabelsToSelfHostedRunnerForRepo: ["POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], + approveWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve"], + cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], + createOrUpdateEnvironmentSecret: ["PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + createRegistrationTokenForOrg: ["POST /orgs/{org}/actions/runners/registration-token"], + createRegistrationTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], + createRemoveTokenForOrg: ["POST /orgs/{org}/actions/runners/remove-token"], + createRemoveTokenForRepo: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], + createWorkflowDispatch: ["POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches"], + deleteActionsCacheById: ["DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}"], + deleteActionsCacheByKey: ["DELETE /repos/{owner}/{repo}/actions/caches{?key,ref}"], + deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + deleteEnvironmentSecret: ["DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + deleteSelfHostedRunnerFromOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}"], + deleteSelfHostedRunnerFromRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"], + deleteWorkflowRun: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}"], + deleteWorkflowRunLogs: ["DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + disableSelectedRepositoryGithubActionsOrganization: ["DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}"], + disableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable"], + downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], + downloadJobLogsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], + downloadWorkflowRunAttemptLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs"], + downloadWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + enableSelectedRepositoryGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories/{repository_id}"], + enableWorkflow: ["PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable"], + getActionsCacheList: ["GET /repos/{owner}/{repo}/actions/caches"], + getActionsCacheUsage: ["GET /repos/{owner}/{repo}/actions/cache/usage"], + getActionsCacheUsageByRepoForOrg: ["GET /orgs/{org}/actions/cache/usage-by-repository"], + getActionsCacheUsageForEnterprise: ["GET /enterprises/{enterprise}/actions/cache/usage"], + getActionsCacheUsageForOrg: ["GET /orgs/{org}/actions/cache/usage"], + getAllowedActionsOrganization: ["GET /orgs/{org}/actions/permissions/selected-actions"], + getAllowedActionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/selected-actions"], + getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getEnvironmentPublicKey: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"], + getEnvironmentSecret: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}"], + getGithubActionsDefaultWorkflowPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsOrganization: ["GET /orgs/{org}/actions/permissions/workflow"], + getGithubActionsDefaultWorkflowPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions/workflow"], + getGithubActionsPermissionsOrganization: ["GET /orgs/{org}/actions/permissions"], + getGithubActionsPermissionsRepository: ["GET /repos/{owner}/{repo}/actions/permissions"], + getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], + getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], + getPendingDeploymentsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], + getRepoPermissions: ["GET /repos/{owner}/{repo}/actions/permissions", {}, { + renamed: ["actions", "getGithubActionsPermissionsRepository"] + }], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{secret_name}"], + getReviewsForRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals"], + getSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}"], + getSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], + getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], + getWorkflowAccessToRepository: ["GET /repos/{owner}/{repo}/actions/permissions/access"], + getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], + getWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}"], + getWorkflowRunUsage: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing"], + getWorkflowUsage: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing"], + listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], + listEnvironmentSecrets: ["GET /repositories/{repository_id}/environments/{environment_name}/secrets"], + listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], + listJobsForWorkflowRunAttempt: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs"], + listLabelsForSelfHostedRunnerForOrg: ["GET /orgs/{org}/actions/runners/{runner_id}/labels"], + listLabelsForSelfHostedRunnerForRepo: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + listOrgSecrets: ["GET /orgs/{org}/actions/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/actions/secrets"], + listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], + listRunnerApplicationsForOrg: ["GET /orgs/{org}/actions/runners/downloads"], + listRunnerApplicationsForRepo: ["GET /repos/{owner}/{repo}/actions/runners/downloads"], + listSelectedReposForOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}/repositories"], + listSelectedRepositoriesEnabledGithubActionsOrganization: ["GET /orgs/{org}/actions/permissions/repositories"], + listSelfHostedRunnersForOrg: ["GET /orgs/{org}/actions/runners"], + listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"], + listWorkflowRunArtifacts: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"], + listWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"], + listWorkflowRunsForRepo: ["GET /repos/{owner}/{repo}/actions/runs"], + reRunJobForWorkflowRun: ["POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun"], + reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"], + reRunWorkflowFailedJobs: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs"], + removeAllCustomLabelsFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels"], + removeAllCustomLabelsFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForOrg: ["DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name}"], + removeCustomLabelFromSelfHostedRunnerForRepo: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name}"], + removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}"], + reviewPendingDeploymentsForRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments"], + setAllowedActionsOrganization: ["PUT /orgs/{org}/actions/permissions/selected-actions"], + setAllowedActionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForOrg: ["PUT /orgs/{org}/actions/runners/{runner_id}/labels"], + setCustomLabelsForSelfHostedRunnerForRepo: ["PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"], + setGithubActionsDefaultWorkflowPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions/workflow"], + setGithubActionsDefaultWorkflowPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/workflow"], + setGithubActionsPermissionsOrganization: ["PUT /orgs/{org}/actions/permissions"], + setGithubActionsPermissionsRepository: ["PUT /repos/{owner}/{repo}/actions/permissions"], + setSelectedReposForOrgSecret: ["PUT /orgs/{org}/actions/secrets/{secret_name}/repositories"], + setSelectedRepositoriesEnabledGithubActionsOrganization: ["PUT /orgs/{org}/actions/permissions/repositories"], + setWorkflowAccessToRepository: ["PUT /repos/{owner}/{repo}/actions/permissions/access"] + }, + activity: { + checkRepoIsStarredByAuthenticatedUser: ["GET /user/starred/{owner}/{repo}"], + deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"], + deleteThreadSubscription: ["DELETE /notifications/threads/{thread_id}/subscription"], + getFeeds: ["GET /feeds"], + getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"], + getThread: ["GET /notifications/threads/{thread_id}"], + getThreadSubscriptionForAuthenticatedUser: ["GET /notifications/threads/{thread_id}/subscription"], + listEventsForAuthenticatedUser: ["GET /users/{username}/events"], + listNotificationsForAuthenticatedUser: ["GET /notifications"], + listOrgEventsForAuthenticatedUser: ["GET /users/{username}/events/orgs/{org}"], + listPublicEvents: ["GET /events"], + listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"], + listPublicEventsForUser: ["GET /users/{username}/events/public"], + listPublicOrgEvents: ["GET /orgs/{org}/events"], + listReceivedEventsForUser: ["GET /users/{username}/received_events"], + listReceivedPublicEventsForUser: ["GET /users/{username}/received_events/public"], + listRepoEvents: ["GET /repos/{owner}/{repo}/events"], + listRepoNotificationsForAuthenticatedUser: ["GET /repos/{owner}/{repo}/notifications"], + listReposStarredByAuthenticatedUser: ["GET /user/starred"], + listReposStarredByUser: ["GET /users/{username}/starred"], + listReposWatchedByUser: ["GET /users/{username}/subscriptions"], + listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"], + listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"], + listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], + markNotificationsAsRead: ["PUT /notifications"], + markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], + setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], + setThreadSubscription: ["PUT /notifications/threads/{thread_id}/subscription"], + starRepoForAuthenticatedUser: ["PUT /user/starred/{owner}/{repo}"], + unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"] + }, + apps: { + addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", {}, { + renamed: ["apps", "addRepoToInstallationForAuthenticatedUser"] + }], + addRepoToInstallationForAuthenticatedUser: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"], + checkToken: ["POST /applications/{client_id}/token"], + createFromManifest: ["POST /app-manifests/{code}/conversions"], + createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"], + deleteAuthorization: ["DELETE /applications/{client_id}/grant"], + deleteInstallation: ["DELETE /app/installations/{installation_id}"], + deleteToken: ["DELETE /applications/{client_id}/token"], + getAuthenticated: ["GET /app"], + getBySlug: ["GET /apps/{app_slug}"], + getInstallation: ["GET /app/installations/{installation_id}"], + getOrgInstallation: ["GET /orgs/{org}/installation"], + getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"], + getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"], + getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], + getUserInstallation: ["GET /users/{username}/installation"], + getWebhookConfigForApp: ["GET /app/hook/config"], + getWebhookDelivery: ["GET /app/hook/deliveries/{delivery_id}"], + listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], + listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], + listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"], + listInstallations: ["GET /app/installations"], + listInstallationsForAuthenticatedUser: ["GET /user/installations"], + listPlans: ["GET /marketplace_listing/plans"], + listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], + listReposAccessibleToInstallation: ["GET /installation/repositories"], + listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"], + listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], + listWebhookDeliveries: ["GET /app/hook/deliveries"], + redeliverWebhookDelivery: ["POST /app/hook/deliveries/{delivery_id}/attempts"], + removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", {}, { + renamed: ["apps", "removeRepoFromInstallationForAuthenticatedUser"] + }], + removeRepoFromInstallationForAuthenticatedUser: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"], + resetToken: ["PATCH /applications/{client_id}/token"], + revokeInstallationAccessToken: ["DELETE /installation/token"], + scopeToken: ["POST /applications/{client_id}/token/scoped"], + suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"], + unsuspendInstallation: ["DELETE /app/installations/{installation_id}/suspended"], + updateWebhookConfigForApp: ["PATCH /app/hook/config"] + }, + billing: { + getGithubActionsBillingOrg: ["GET /orgs/{org}/settings/billing/actions"], + getGithubActionsBillingUser: ["GET /users/{username}/settings/billing/actions"], + getGithubAdvancedSecurityBillingGhe: ["GET /enterprises/{enterprise}/settings/billing/advanced-security"], + getGithubAdvancedSecurityBillingOrg: ["GET /orgs/{org}/settings/billing/advanced-security"], + getGithubPackagesBillingOrg: ["GET /orgs/{org}/settings/billing/packages"], + getGithubPackagesBillingUser: ["GET /users/{username}/settings/billing/packages"], + getSharedStorageBillingOrg: ["GET /orgs/{org}/settings/billing/shared-storage"], + getSharedStorageBillingUser: ["GET /users/{username}/settings/billing/shared-storage"] + }, + checks: { + create: ["POST /repos/{owner}/{repo}/check-runs"], + createSuite: ["POST /repos/{owner}/{repo}/check-suites"], + get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}"], + getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}"], + listAnnotations: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations"], + listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs"], + listForSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs"], + listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites"], + rerequestRun: ["POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest"], + rerequestSuite: ["POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest"], + setSuitesPreferences: ["PATCH /repos/{owner}/{repo}/check-suites/preferences"], + update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}"] + }, + codeScanning: { + deleteAnalysis: ["DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}"], + getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, { + renamedParameters: { + alert_id: "alert_number" + } + }], + getAnalysis: ["GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}"], + getSarif: ["GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}"], + listAlertInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances"], + listAlertsForOrg: ["GET /orgs/{org}/code-scanning/alerts"], + listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"], + listAlertsInstances: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances", {}, { + renamed: ["codeScanning", "listAlertInstances"] + }], + listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"], + updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"], + uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"] + }, + codesOfConduct: { + getAllCodesOfConduct: ["GET /codes_of_conduct"], + getConductCode: ["GET /codes_of_conduct/{key}"] + }, + codespaces: { + addRepositoryForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + codespaceMachinesForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/machines"], + createForAuthenticatedUser: ["POST /user/codespaces"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + createOrUpdateSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}"], + createWithPrForAuthenticatedUser: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces"], + createWithRepoForAuthenticatedUser: ["POST /repos/{owner}/{repo}/codespaces"], + deleteForAuthenticatedUser: ["DELETE /user/codespaces/{codespace_name}"], + deleteFromOrganization: ["DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + deleteSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}"], + exportForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/exports"], + getExportDetailsForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}/exports/{export_id}"], + getForAuthenticatedUser: ["GET /user/codespaces/{codespace_name}"], + getPublicKeyForAuthenticatedUser: ["GET /user/codespaces/secrets/public-key"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/codespaces/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}"], + getSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}"], + listDevcontainersInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/devcontainers"], + listForAuthenticatedUser: ["GET /user/codespaces"], + listInOrganization: ["GET /orgs/{org}/codespaces", {}, { + renamedParameters: { + org_id: "org" + } + }], + listInRepositoryForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/codespaces/secrets"], + listRepositoriesForSecretForAuthenticatedUser: ["GET /user/codespaces/secrets/{secret_name}/repositories"], + listSecretsForAuthenticatedUser: ["GET /user/codespaces/secrets"], + removeRepositoryForSecretForAuthenticatedUser: ["DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id}"], + repoMachinesForAuthenticatedUser: ["GET /repos/{owner}/{repo}/codespaces/machines"], + setRepositoriesForSecretForAuthenticatedUser: ["PUT /user/codespaces/secrets/{secret_name}/repositories"], + startForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/start"], + stopForAuthenticatedUser: ["POST /user/codespaces/{codespace_name}/stop"], + stopInOrganization: ["POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop"], + updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"] + }, + dependabot: { + addSelectedRepoToOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + createOrUpdateOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}"], + createOrUpdateRepoSecret: ["PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + deleteOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}"], + deleteRepoSecret: ["DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + getOrgPublicKey: ["GET /orgs/{org}/dependabot/secrets/public-key"], + getOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}"], + getRepoPublicKey: ["GET /repos/{owner}/{repo}/dependabot/secrets/public-key"], + getRepoSecret: ["GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name}"], + listOrgSecrets: ["GET /orgs/{org}/dependabot/secrets"], + listRepoSecrets: ["GET /repos/{owner}/{repo}/dependabot/secrets"], + listSelectedReposForOrgSecret: ["GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories"], + removeSelectedRepoFromOrgSecret: ["DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}"], + setSelectedReposForOrgSecret: ["PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories"] + }, + dependencyGraph: { + createRepositorySnapshot: ["POST /repos/{owner}/{repo}/dependency-graph/snapshots"], + diffRange: ["GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}"] + }, + emojis: { + get: ["GET /emojis"] + }, + enterpriseAdmin: { + addCustomLabelsToSelfHostedRunnerForEnterprise: ["POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + disableSelectedOrganizationGithubActionsEnterprise: ["DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], + enableSelectedOrganizationGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}"], + getAllowedActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/selected-actions"], + getGithubActionsPermissionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions"], + getServerStatistics: ["GET /enterprise-installation/{enterprise_or_org}/server-statistics"], + listLabelsForSelfHostedRunnerForEnterprise: ["GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + listSelectedOrganizationsEnabledGithubActionsEnterprise: ["GET /enterprises/{enterprise}/actions/permissions/organizations"], + removeAllCustomLabelsFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + removeCustomLabelFromSelfHostedRunnerForEnterprise: ["DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name}"], + setAllowedActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/selected-actions"], + setCustomLabelsForSelfHostedRunnerForEnterprise: ["PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels"], + setGithubActionsPermissionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions"], + setSelectedOrganizationsEnabledGithubActionsEnterprise: ["PUT /enterprises/{enterprise}/actions/permissions/organizations"] + }, + gists: { + checkIsStarred: ["GET /gists/{gist_id}/star"], + create: ["POST /gists"], + createComment: ["POST /gists/{gist_id}/comments"], + delete: ["DELETE /gists/{gist_id}"], + deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"], + fork: ["POST /gists/{gist_id}/forks"], + get: ["GET /gists/{gist_id}"], + getComment: ["GET /gists/{gist_id}/comments/{comment_id}"], + getRevision: ["GET /gists/{gist_id}/{sha}"], + list: ["GET /gists"], + listComments: ["GET /gists/{gist_id}/comments"], + listCommits: ["GET /gists/{gist_id}/commits"], + listForUser: ["GET /users/{username}/gists"], + listForks: ["GET /gists/{gist_id}/forks"], + listPublic: ["GET /gists/public"], + listStarred: ["GET /gists/starred"], + star: ["PUT /gists/{gist_id}/star"], + unstar: ["DELETE /gists/{gist_id}/star"], + update: ["PATCH /gists/{gist_id}"], + updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"] + }, + git: { + createBlob: ["POST /repos/{owner}/{repo}/git/blobs"], + createCommit: ["POST /repos/{owner}/{repo}/git/commits"], + createRef: ["POST /repos/{owner}/{repo}/git/refs"], + createTag: ["POST /repos/{owner}/{repo}/git/tags"], + createTree: ["POST /repos/{owner}/{repo}/git/trees"], + deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"], + getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"], + getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"], + getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"], + getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"], + getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"], + listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"], + updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"] + }, + gitignore: { + getAllTemplates: ["GET /gitignore/templates"], + getTemplate: ["GET /gitignore/templates/{name}"] + }, + interactions: { + getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"], + getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"], + getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits"], + getRestrictionsForYourPublicRepos: ["GET /user/interaction-limits", {}, { + renamed: ["interactions", "getRestrictionsForAuthenticatedUser"] + }], + removeRestrictionsForAuthenticatedUser: ["DELETE /user/interaction-limits"], + removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits"], + removeRestrictionsForRepo: ["DELETE /repos/{owner}/{repo}/interaction-limits"], + removeRestrictionsForYourPublicRepos: ["DELETE /user/interaction-limits", {}, { + renamed: ["interactions", "removeRestrictionsForAuthenticatedUser"] + }], + setRestrictionsForAuthenticatedUser: ["PUT /user/interaction-limits"], + setRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits"], + setRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits"], + setRestrictionsForYourPublicRepos: ["PUT /user/interaction-limits", {}, { + renamed: ["interactions", "setRestrictionsForAuthenticatedUser"] + }] + }, + issues: { + addAssignees: ["POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"], + checkUserCanBeAssigned: ["GET /repos/{owner}/{repo}/assignees/{assignee}"], + create: ["POST /repos/{owner}/{repo}/issues"], + createComment: ["POST /repos/{owner}/{repo}/issues/{issue_number}/comments"], + createLabel: ["POST /repos/{owner}/{repo}/labels"], + createMilestone: ["POST /repos/{owner}/{repo}/milestones"], + deleteComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"], + deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"], + deleteMilestone: ["DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"], + get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"], + getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"], + getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"], + getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"], + getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"], + list: ["GET /issues"], + listAssignees: ["GET /repos/{owner}/{repo}/assignees"], + listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"], + listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"], + listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"], + listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"], + listEventsForTimeline: ["GET /repos/{owner}/{repo}/issues/{issue_number}/timeline"], + listForAuthenticatedUser: ["GET /user/issues"], + listForOrg: ["GET /orgs/{org}/issues"], + listForRepo: ["GET /repos/{owner}/{repo}/issues"], + listLabelsForMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"], + listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"], + listLabelsOnIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/labels"], + listMilestones: ["GET /repos/{owner}/{repo}/milestones"], + lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"], + removeAllLabels: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"], + removeAssignees: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + removeLabel: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"], + setLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"], + unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"], + update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"], + updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"], + updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"], + updateMilestone: ["PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"] + }, + licenses: { + get: ["GET /licenses/{license}"], + getAllCommonlyUsed: ["GET /licenses"], + getForRepo: ["GET /repos/{owner}/{repo}/license"] + }, + markdown: { + render: ["POST /markdown"], + renderRaw: ["POST /markdown/raw", { + headers: { + "content-type": "text/plain; charset=utf-8" + } + }] + }, + meta: { + get: ["GET /meta"], + getOctocat: ["GET /octocat"], + getZen: ["GET /zen"], + root: ["GET /"] + }, + migrations: { + cancelImport: ["DELETE /repos/{owner}/{repo}/import"], + deleteArchiveForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/archive"], + deleteArchiveForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/archive"], + downloadArchiveForOrg: ["GET /orgs/{org}/migrations/{migration_id}/archive"], + getArchiveForAuthenticatedUser: ["GET /user/migrations/{migration_id}/archive"], + getCommitAuthors: ["GET /repos/{owner}/{repo}/import/authors"], + getImportStatus: ["GET /repos/{owner}/{repo}/import"], + getLargeFiles: ["GET /repos/{owner}/{repo}/import/large_files"], + getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}"], + getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}"], + listForAuthenticatedUser: ["GET /user/migrations"], + listForOrg: ["GET /orgs/{org}/migrations"], + listReposForAuthenticatedUser: ["GET /user/migrations/{migration_id}/repositories"], + listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories"], + listReposForUser: ["GET /user/migrations/{migration_id}/repositories", {}, { + renamed: ["migrations", "listReposForAuthenticatedUser"] + }], + mapCommitAuthor: ["PATCH /repos/{owner}/{repo}/import/authors/{author_id}"], + setLfsPreference: ["PATCH /repos/{owner}/{repo}/import/lfs"], + startForAuthenticatedUser: ["POST /user/migrations"], + startForOrg: ["POST /orgs/{org}/migrations"], + startImport: ["PUT /repos/{owner}/{repo}/import"], + unlockRepoForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock"], + unlockRepoForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock"], + updateImport: ["PATCH /repos/{owner}/{repo}/import"] + }, + orgs: { + blockUser: ["PUT /orgs/{org}/blocks/{username}"], + cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"], + checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], + checkMembershipForUser: ["GET /orgs/{org}/members/{username}"], + checkPublicMembershipForUser: ["GET /orgs/{org}/public_members/{username}"], + convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"], + createInvitation: ["POST /orgs/{org}/invitations"], + createWebhook: ["POST /orgs/{org}/hooks"], + deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], + get: ["GET /orgs/{org}"], + getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], + getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], + getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], + getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], + getWebhookDelivery: ["GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}"], + list: ["GET /organizations"], + listAppInstallations: ["GET /orgs/{org}/installations"], + listBlockedUsers: ["GET /orgs/{org}/blocks"], + listCustomRoles: ["GET /organizations/{organization_id}/custom_roles"], + listFailedInvitations: ["GET /orgs/{org}/failed_invitations"], + listForAuthenticatedUser: ["GET /user/orgs"], + listForUser: ["GET /users/{username}/orgs"], + listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], + listMembers: ["GET /orgs/{org}/members"], + listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], + listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], + listPendingInvitations: ["GET /orgs/{org}/invitations"], + listPublicMembers: ["GET /orgs/{org}/public_members"], + listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"], + listWebhooks: ["GET /orgs/{org}/hooks"], + pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], + redeliverWebhookDelivery: ["POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"], + removeMember: ["DELETE /orgs/{org}/members/{username}"], + removeMembershipForUser: ["DELETE /orgs/{org}/memberships/{username}"], + removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"], + removePublicMembershipForAuthenticatedUser: ["DELETE /orgs/{org}/public_members/{username}"], + setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"], + setPublicMembershipForAuthenticatedUser: ["PUT /orgs/{org}/public_members/{username}"], + unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], + update: ["PATCH /orgs/{org}"], + updateMembershipForAuthenticatedUser: ["PATCH /user/memberships/orgs/{org}"], + updateWebhook: ["PATCH /orgs/{org}/hooks/{hook_id}"], + updateWebhookConfigForOrg: ["PATCH /orgs/{org}/hooks/{hook_id}/config"] + }, + packages: { + deletePackageForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}"], + deletePackageForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}"], + deletePackageForUser: ["DELETE /users/{username}/packages/{package_type}/{package_name}"], + deletePackageVersionForAuthenticatedUser: ["DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}"], + deletePackageVersionForOrg: ["DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + deletePackageVersionForUser: ["DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getAllPackageVersionsForAPackageOwnedByAnOrg: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions", {}, { + renamed: ["packages", "getAllPackageVersionsForPackageOwnedByOrg"] + }], + getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions", {}, { + renamed: ["packages", "getAllPackageVersionsForPackageOwnedByAuthenticatedUser"] + }], + getAllPackageVersionsForPackageOwnedByAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions"], + getAllPackageVersionsForPackageOwnedByOrg: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions"], + getAllPackageVersionsForPackageOwnedByUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions"], + getPackageForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}"], + getPackageForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}"], + getPackageForUser: ["GET /users/{username}/packages/{package_type}/{package_name}"], + getPackageVersionForAuthenticatedUser: ["GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getPackageVersionForOrganization: ["GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + getPackageVersionForUser: ["GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}"], + listPackagesForAuthenticatedUser: ["GET /user/packages"], + listPackagesForOrganization: ["GET /orgs/{org}/packages"], + listPackagesForUser: ["GET /users/{username}/packages"], + restorePackageForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageForUser: ["POST /users/{username}/packages/{package_type}/{package_name}/restore{?token}"], + restorePackageVersionForAuthenticatedUser: ["POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"], + restorePackageVersionForOrg: ["POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"], + restorePackageVersionForUser: ["POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore"] + }, + projects: { + addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}"], + createCard: ["POST /projects/columns/{column_id}/cards"], + createColumn: ["POST /projects/{project_id}/columns"], + createForAuthenticatedUser: ["POST /user/projects"], + createForOrg: ["POST /orgs/{org}/projects"], + createForRepo: ["POST /repos/{owner}/{repo}/projects"], + delete: ["DELETE /projects/{project_id}"], + deleteCard: ["DELETE /projects/columns/cards/{card_id}"], + deleteColumn: ["DELETE /projects/columns/{column_id}"], + get: ["GET /projects/{project_id}"], + getCard: ["GET /projects/columns/cards/{card_id}"], + getColumn: ["GET /projects/columns/{column_id}"], + getPermissionForUser: ["GET /projects/{project_id}/collaborators/{username}/permission"], + listCards: ["GET /projects/columns/{column_id}/cards"], + listCollaborators: ["GET /projects/{project_id}/collaborators"], + listColumns: ["GET /projects/{project_id}/columns"], + listForOrg: ["GET /orgs/{org}/projects"], + listForRepo: ["GET /repos/{owner}/{repo}/projects"], + listForUser: ["GET /users/{username}/projects"], + moveCard: ["POST /projects/columns/cards/{card_id}/moves"], + moveColumn: ["POST /projects/columns/{column_id}/moves"], + removeCollaborator: ["DELETE /projects/{project_id}/collaborators/{username}"], + update: ["PATCH /projects/{project_id}"], + updateCard: ["PATCH /projects/columns/cards/{card_id}"], + updateColumn: ["PATCH /projects/columns/{column_id}"] + }, + pulls: { + checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + create: ["POST /repos/{owner}/{repo}/pulls"], + createReplyForReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"], + createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + createReviewComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + deletePendingReview: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + deleteReviewComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + dismissReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"], + get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"], + getReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + getReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + list: ["GET /repos/{owner}/{repo}/pulls"], + listCommentsForReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"], + listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"], + listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"], + listRequestedReviewers: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + listReviewComments: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + listReviewCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"], + listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + removeRequestedReviewers: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + requestReviewers: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + submitReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"], + update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"], + updateBranch: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch"], + updateReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + updateReviewComment: ["PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"] + }, + rateLimit: { + get: ["GET /rate_limit"] + }, + reactions: { + createForCommitComment: ["POST /repos/{owner}/{repo}/comments/{comment_id}/reactions"], + createForIssue: ["POST /repos/{owner}/{repo}/issues/{issue_number}/reactions"], + createForIssueComment: ["POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"], + createForPullRequestReviewComment: ["POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"], + createForRelease: ["POST /repos/{owner}/{repo}/releases/{release_id}/reactions"], + createForTeamDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"], + createForTeamDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"], + deleteForCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}"], + deleteForIssue: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}"], + deleteForIssueComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}"], + deleteForPullRequestComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}"], + deleteForRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id}"], + deleteForTeamDiscussion: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}"], + deleteForTeamDiscussionComment: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}"], + listForCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}/reactions"], + listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions"], + listForIssueComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions"], + listForPullRequestReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions"], + listForRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}/reactions"], + listForTeamDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions"], + listForTeamDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions"] + }, + repos: { + acceptInvitation: ["PATCH /user/repository_invitations/{invitation_id}", {}, { + renamed: ["repos", "acceptInvitationForAuthenticatedUser"] + }], + acceptInvitationForAuthenticatedUser: ["PATCH /user/repository_invitations/{invitation_id}"], + addAppAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"], + addStatusCheckContexts: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + addTeamAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + addUserAccessRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"], + checkVulnerabilityAlerts: ["GET /repos/{owner}/{repo}/vulnerability-alerts"], + codeownersErrors: ["GET /repos/{owner}/{repo}/codeowners/errors"], + compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"], + compareCommitsWithBasehead: ["GET /repos/{owner}/{repo}/compare/{basehead}"], + createAutolink: ["POST /repos/{owner}/{repo}/autolinks"], + createCommitComment: ["POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + createCommitSignatureProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + createCommitStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"], + createDeployKey: ["POST /repos/{owner}/{repo}/keys"], + createDeployment: ["POST /repos/{owner}/{repo}/deployments"], + createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"], + createForAuthenticatedUser: ["POST /user/repos"], + createFork: ["POST /repos/{owner}/{repo}/forks"], + createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateEnvironment: ["PUT /repos/{owner}/{repo}/environments/{environment_name}"], + createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"], + createPagesSite: ["POST /repos/{owner}/{repo}/pages"], + createRelease: ["POST /repos/{owner}/{repo}/releases"], + createTagProtection: ["POST /repos/{owner}/{repo}/tags/protection"], + createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate"], + createWebhook: ["POST /repos/{owner}/{repo}/hooks"], + declineInvitation: ["DELETE /user/repository_invitations/{invitation_id}", {}, { + renamed: ["repos", "declineInvitationForAuthenticatedUser"] + }], + declineInvitationForAuthenticatedUser: ["DELETE /user/repository_invitations/{invitation_id}"], + delete: ["DELETE /repos/{owner}/{repo}"], + deleteAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + deleteAdminBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + deleteAnEnvironment: ["DELETE /repos/{owner}/{repo}/environments/{environment_name}"], + deleteAutolink: ["DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}"], + deleteBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection"], + deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"], + deleteCommitSignatureProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + deleteDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"], + deleteDeployment: ["DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"], + deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"], + deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"], + deletePagesSite: ["DELETE /repos/{owner}/{repo}/pages"], + deletePullRequestReviewProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"], + deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"], + deleteTagProtection: ["DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id}"], + deleteWebhook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"], + disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes"], + disableLfsForRepo: ["DELETE /repos/{owner}/{repo}/lfs"], + disableVulnerabilityAlerts: ["DELETE /repos/{owner}/{repo}/vulnerability-alerts"], + downloadArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}", {}, { + renamed: ["repos", "downloadZipballArchive"] + }], + downloadTarballArchive: ["GET /repos/{owner}/{repo}/tarball/{ref}"], + downloadZipballArchive: ["GET /repos/{owner}/{repo}/zipball/{ref}"], + enableAutomatedSecurityFixes: ["PUT /repos/{owner}/{repo}/automated-security-fixes"], + enableLfsForRepo: ["PUT /repos/{owner}/{repo}/lfs"], + enableVulnerabilityAlerts: ["PUT /repos/{owner}/{repo}/vulnerability-alerts"], + generateReleaseNotes: ["POST /repos/{owner}/{repo}/releases/generate-notes"], + get: ["GET /repos/{owner}/{repo}"], + getAccessRestrictions: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + getAdminBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + getAllEnvironments: ["GET /repos/{owner}/{repo}/environments"], + getAllStatusCheckContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"], + getAllTopics: ["GET /repos/{owner}/{repo}/topics"], + getAppsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"], + getAutolink: ["GET /repos/{owner}/{repo}/autolinks/{autolink_id}"], + getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], + getBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection"], + getClones: ["GET /repos/{owner}/{repo}/traffic/clones"], + getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"], + getCollaboratorPermissionLevel: ["GET /repos/{owner}/{repo}/collaborators/{username}/permission"], + getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"], + getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"], + getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"], + getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"], + getCommitSignatureProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures"], + getCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"], + getContent: ["GET /repos/{owner}/{repo}/contents/{path}"], + getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"], + getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"], + getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"], + getDeploymentStatus: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"], + getEnvironment: ["GET /repos/{owner}/{repo}/environments/{environment_name}"], + getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"], + getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"], + getPages: ["GET /repos/{owner}/{repo}/pages"], + getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"], + getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], + getPullRequestReviewProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"], + getReadme: ["GET /repos/{owner}/{repo}/readme"], + getReadmeInDirectory: ["GET /repos/{owner}/{repo}/readme/{dir}"], + getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"], + getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"], + getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"], + getStatusChecksProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + getTeamsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"], + getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"], + getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"], + getUsersWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"], + getViews: ["GET /repos/{owner}/{repo}/traffic/views"], + getWebhook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"], + getWebhookConfigForRepo: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/config"], + getWebhookDelivery: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}"], + listAutolinks: ["GET /repos/{owner}/{repo}/autolinks"], + listBranches: ["GET /repos/{owner}/{repo}/branches"], + listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head"], + listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"], + listCommentsForCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + listCommitCommentsForRepo: ["GET /repos/{owner}/{repo}/comments"], + listCommitStatusesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/statuses"], + listCommits: ["GET /repos/{owner}/{repo}/commits"], + listContributors: ["GET /repos/{owner}/{repo}/contributors"], + listDeployKeys: ["GET /repos/{owner}/{repo}/keys"], + listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + listDeployments: ["GET /repos/{owner}/{repo}/deployments"], + listForAuthenticatedUser: ["GET /user/repos"], + listForOrg: ["GET /orgs/{org}/repos"], + listForUser: ["GET /users/{username}/repos"], + listForks: ["GET /repos/{owner}/{repo}/forks"], + listInvitations: ["GET /repos/{owner}/{repo}/invitations"], + listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"], + listLanguages: ["GET /repos/{owner}/{repo}/languages"], + listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"], + listPublic: ["GET /repositories"], + listPullRequestsAssociatedWithCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls"], + listReleaseAssets: ["GET /repos/{owner}/{repo}/releases/{release_id}/assets"], + listReleases: ["GET /repos/{owner}/{repo}/releases"], + listTagProtection: ["GET /repos/{owner}/{repo}/tags/protection"], + listTags: ["GET /repos/{owner}/{repo}/tags"], + listTeams: ["GET /repos/{owner}/{repo}/teams"], + listWebhookDeliveries: ["GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries"], + listWebhooks: ["GET /repos/{owner}/{repo}/hooks"], + merge: ["POST /repos/{owner}/{repo}/merges"], + mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"], + pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"], + redeliverWebhookDelivery: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"], + removeAppAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + removeCollaborator: ["DELETE /repos/{owner}/{repo}/collaborators/{username}"], + removeStatusCheckContexts: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + removeStatusCheckProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + removeTeamAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + removeUserAccessRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + renameBranch: ["POST /repos/{owner}/{repo}/branches/{branch}/rename"], + replaceAllTopics: ["PUT /repos/{owner}/{repo}/topics"], + requestPagesBuild: ["POST /repos/{owner}/{repo}/pages/builds"], + setAdminBranchProtection: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + setAppAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + setStatusCheckContexts: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + setTeamAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + setUserAccessRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + testPushWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"], + transfer: ["POST /repos/{owner}/{repo}/transfer"], + update: ["PATCH /repos/{owner}/{repo}"], + updateBranchProtection: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection"], + updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"], + updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"], + updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"], + updatePullRequestReviewProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"], + updateReleaseAsset: ["PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"], + updateStatusCheckPotection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks", {}, { + renamed: ["repos", "updateStatusCheckProtection"] + }], + updateStatusCheckProtection: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + updateWebhook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"], + updateWebhookConfigForRepo: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config"], + uploadReleaseAsset: ["POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}", { + baseUrl: "https://uploads.github.com" + }] + }, + search: { + code: ["GET /search/code"], + commits: ["GET /search/commits"], + issuesAndPullRequests: ["GET /search/issues"], + labels: ["GET /search/labels"], + repos: ["GET /search/repositories"], + topics: ["GET /search/topics"], + users: ["GET /search/users"] + }, + secretScanning: { + getAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"], + listAlertsForEnterprise: ["GET /enterprises/{enterprise}/secret-scanning/alerts"], + listAlertsForOrg: ["GET /orgs/{org}/secret-scanning/alerts"], + listAlertsForRepo: ["GET /repos/{owner}/{repo}/secret-scanning/alerts"], + listLocationsForAlert: ["GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations"], + updateAlert: ["PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}"] + }, + teams: { + addOrUpdateMembershipForUserInOrg: ["PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"], + addOrUpdateProjectPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + addOrUpdateRepoPermissionsInOrg: ["PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + checkPermissionsForProjectInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + checkPermissionsForRepoInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + create: ["POST /orgs/{org}/teams"], + createDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"], + deleteDiscussionCommentInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + deleteDiscussionInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"], + getByName: ["GET /orgs/{org}/teams/{team_slug}"], + getDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + getDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + getMembershipForUserInOrg: ["GET /orgs/{org}/teams/{team_slug}/memberships/{username}"], + list: ["GET /orgs/{org}/teams"], + listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"], + listDiscussionCommentsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"], + listForAuthenticatedUser: ["GET /user/teams"], + listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"], + listPendingInvitationsInOrg: ["GET /orgs/{org}/teams/{team_slug}/invitations"], + listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects"], + listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"], + removeMembershipForUserInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"], + removeProjectInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + removeRepoInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + updateDiscussionCommentInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + updateDiscussionInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"] + }, + users: { + addEmailForAuthenticated: ["POST /user/emails", {}, { + renamed: ["users", "addEmailForAuthenticatedUser"] + }], + addEmailForAuthenticatedUser: ["POST /user/emails"], + block: ["PUT /user/blocks/{username}"], + checkBlocked: ["GET /user/blocks/{username}"], + checkFollowingForUser: ["GET /users/{username}/following/{target_user}"], + checkPersonIsFollowedByAuthenticated: ["GET /user/following/{username}"], + createGpgKeyForAuthenticated: ["POST /user/gpg_keys", {}, { + renamed: ["users", "createGpgKeyForAuthenticatedUser"] + }], + createGpgKeyForAuthenticatedUser: ["POST /user/gpg_keys"], + createPublicSshKeyForAuthenticated: ["POST /user/keys", {}, { + renamed: ["users", "createPublicSshKeyForAuthenticatedUser"] + }], + createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"], + deleteEmailForAuthenticated: ["DELETE /user/emails", {}, { + renamed: ["users", "deleteEmailForAuthenticatedUser"] + }], + deleteEmailForAuthenticatedUser: ["DELETE /user/emails"], + deleteGpgKeyForAuthenticated: ["DELETE /user/gpg_keys/{gpg_key_id}", {}, { + renamed: ["users", "deleteGpgKeyForAuthenticatedUser"] + }], + deleteGpgKeyForAuthenticatedUser: ["DELETE /user/gpg_keys/{gpg_key_id}"], + deletePublicSshKeyForAuthenticated: ["DELETE /user/keys/{key_id}", {}, { + renamed: ["users", "deletePublicSshKeyForAuthenticatedUser"] + }], + deletePublicSshKeyForAuthenticatedUser: ["DELETE /user/keys/{key_id}"], + follow: ["PUT /user/following/{username}"], + getAuthenticated: ["GET /user"], + getByUsername: ["GET /users/{username}"], + getContextForUser: ["GET /users/{username}/hovercard"], + getGpgKeyForAuthenticated: ["GET /user/gpg_keys/{gpg_key_id}", {}, { + renamed: ["users", "getGpgKeyForAuthenticatedUser"] + }], + getGpgKeyForAuthenticatedUser: ["GET /user/gpg_keys/{gpg_key_id}"], + getPublicSshKeyForAuthenticated: ["GET /user/keys/{key_id}", {}, { + renamed: ["users", "getPublicSshKeyForAuthenticatedUser"] + }], + getPublicSshKeyForAuthenticatedUser: ["GET /user/keys/{key_id}"], + list: ["GET /users"], + listBlockedByAuthenticated: ["GET /user/blocks", {}, { + renamed: ["users", "listBlockedByAuthenticatedUser"] + }], + listBlockedByAuthenticatedUser: ["GET /user/blocks"], + listEmailsForAuthenticated: ["GET /user/emails", {}, { + renamed: ["users", "listEmailsForAuthenticatedUser"] + }], + listEmailsForAuthenticatedUser: ["GET /user/emails"], + listFollowedByAuthenticated: ["GET /user/following", {}, { + renamed: ["users", "listFollowedByAuthenticatedUser"] + }], + listFollowedByAuthenticatedUser: ["GET /user/following"], + listFollowersForAuthenticatedUser: ["GET /user/followers"], + listFollowersForUser: ["GET /users/{username}/followers"], + listFollowingForUser: ["GET /users/{username}/following"], + listGpgKeysForAuthenticated: ["GET /user/gpg_keys", {}, { + renamed: ["users", "listGpgKeysForAuthenticatedUser"] + }], + listGpgKeysForAuthenticatedUser: ["GET /user/gpg_keys"], + listGpgKeysForUser: ["GET /users/{username}/gpg_keys"], + listPublicEmailsForAuthenticated: ["GET /user/public_emails", {}, { + renamed: ["users", "listPublicEmailsForAuthenticatedUser"] + }], + listPublicEmailsForAuthenticatedUser: ["GET /user/public_emails"], + listPublicKeysForUser: ["GET /users/{username}/keys"], + listPublicSshKeysForAuthenticated: ["GET /user/keys", {}, { + renamed: ["users", "listPublicSshKeysForAuthenticatedUser"] + }], + listPublicSshKeysForAuthenticatedUser: ["GET /user/keys"], + setPrimaryEmailVisibilityForAuthenticated: ["PATCH /user/email/visibility", {}, { + renamed: ["users", "setPrimaryEmailVisibilityForAuthenticatedUser"] + }], + setPrimaryEmailVisibilityForAuthenticatedUser: ["PATCH /user/email/visibility"], + unblock: ["DELETE /user/blocks/{username}"], + unfollow: ["DELETE /user/following/{username}"], + updateAuthenticated: ["PATCH /user"] + } +}; + +const VERSION = "5.16.2"; + +function endpointsToMethods(octokit, endpointsMap) { + const newMethods = {}; + + for (const [scope, endpoints] of Object.entries(endpointsMap)) { + for (const [methodName, endpoint] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint; + const [method, url] = route.split(/ /); + const endpointDefaults = Object.assign({ + method, + url + }, defaults); + + if (!newMethods[scope]) { + newMethods[scope] = {}; + } + + const scopeMethods = newMethods[scope]; + + if (decorations) { + scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); + continue; + } + + scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); + } + } + + return newMethods; +} + +function decorate(octokit, scope, methodName, defaults, decorations) { + const requestWithDefaults = octokit.request.defaults(defaults); + /* istanbul ignore next */ + + function withDecorations(...args) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` + + if (decorations.mapToData) { + options = Object.assign({}, options, { + data: options[decorations.mapToData], + [decorations.mapToData]: undefined + }); + return requestWithDefaults(options); + } + + if (decorations.renamed) { + const [newScope, newMethodName] = decorations.renamed; + octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`); + } + + if (decorations.deprecated) { + octokit.log.warn(decorations.deprecated); + } + + if (decorations.renamedParameters) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + const options = requestWithDefaults.endpoint.merge(...args); + + for (const [name, alias] of Object.entries(decorations.renamedParameters)) { + if (name in options) { + octokit.log.warn(`"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead`); + + if (!(alias in options)) { + options[alias] = options[name]; + } + + delete options[name]; + } + } + + return requestWithDefaults(options); + } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + + + return requestWithDefaults(...args); + } + + return Object.assign(withDecorations, requestWithDefaults); +} + +function restEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return { + rest: api + }; +} +restEndpointMethods.VERSION = VERSION; +function legacyRestEndpointMethods(octokit) { + const api = endpointsToMethods(octokit, Endpoints); + return _objectSpread2(_objectSpread2({}, api), {}, { + rest: api + }); +} +legacyRestEndpointMethods.VERSION = VERSION; + +exports.legacyRestEndpointMethods = legacyRestEndpointMethods; +exports.restEndpointMethods = restEndpointMethods; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ 537: @@ -66938,7 +69162,7 @@ function isProbablyGradleDaemonProblem(packageManager, error) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NATIVE_IMAGE_OPTIONS_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.NATIVE_IMAGE_OPTIONS_FILE = exports.ENV_NATIVE_IMAGE_CONFIG_FILE = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_REPORT_ARTIFACT = exports.INPUT_NI_REPORT_PR = exports.INPUT_NI_REPORT_JOB = exports.INPUT_NI_MUSL = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; @@ -66963,7 +69187,10 @@ exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : ''; exports.MANDREL_NAMESPACE = 'mandrel-'; exports.GDS_BASE = 'https://gds.oracle.com/api/20220101'; exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'; +exports.ENV_NATIVE_IMAGE_CONFIG_FILE = 'NATIVE_IMAGE_CONFIG_FILE'; exports.NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties'; +exports.ENV_GITHUB_EVENT_NAME = "GITHUB_EVENT_NAME"; +exports.EVENT_NAME_PULL_REQUEST = "pull_request"; function determineGraalVMArchitecture() { switch (process.arch) { case 'x64': { @@ -67538,8 +69765,11 @@ function setUpGUComponents(gdsToken, graalVMHome, components) { }); } exports.setUpGUComponents = setUpGUComponents; +let version; function getVersionString() { return __awaiter(this, void 0, void 0, function* () { + if (version) + return version; let output = ""; const options = { listeners: { @@ -67550,7 +69780,7 @@ function getVersionString() { }; yield utils_1.exec('gu', ['--version'], options); const versionParts = output.split(' '); - return versionParts[versionParts.length - 1]; + return version = versionParts[versionParts.length - 1]; }); } exports.getVersionString = getVersionString; @@ -67995,7 +70225,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; +exports.getGitHubToken = exports.isArtReport = exports.isNativeImageArtifactReport = exports.isPrEvent = exports.isPrReport = exports.isJobReport = exports.isNativeImageBuildReport = void 0; const core = __importStar(__nccwpck_require__(2186)); const c = __importStar(__nccwpck_require__(9042)); const utils_1 = __nccwpck_require__(1314); @@ -68012,9 +70242,13 @@ function isJobReport() { } exports.isJobReport = isJobReport; function isPrReport() { - return core.getBooleanInput(c.INPUT_NI_REPORT_PR); + return isPrEvent() && core.getBooleanInput(c.INPUT_NI_REPORT_PR); } exports.isPrReport = isPrReport; +function isPrEvent() { + return process.env[c.ENV_GITHUB_EVENT_NAME] === c.EVENT_NAME_PULL_REQUEST; +} +exports.isPrEvent = isPrEvent; function isNativeImageArtifactReport() { return __awaiter(this, void 0, void 0, function* () { const version = yield utils_1.getGVMversion(); @@ -68027,6 +70261,10 @@ function isArtReport() { return false; //core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); } exports.isArtReport = isArtReport; +function getGitHubToken() { + return core.getInput(c.INPUT_GITHUB_TOKEN); +} +exports.getGitHubToken = getGitHubToken; /***/ }), @@ -68092,7 +70330,7 @@ exports.setUpNIBuildReport = setUpNIBuildReport; const descend = (v1, v2) => v2.size - v1.size; const sum = (n1, n2) => n1 + n2; function createNIArtifactReport() { - let out = ""; + let out = mark.header("Native Image Artifact Report", 1); const data = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[dashboardNIDef_1.HEAP_BREAKDOWN]; const codeBreakdown = data[dashboardNIDef_1.CODE_BREAKDOWN]; @@ -68125,7 +70363,8 @@ function packagesToTable(pkgs) { function createNIBuildReport() { return __awaiter(this, void 0, void 0, function* () { const data = JSON.parse(fs.readFileSync("outputReport.json").toString()); - let out = mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); + let out = mark.header("Native Image Build Output Report", 1); + out += mark.header(`Generated ${data[buildOutputDef_1.GENERAL_INFO][buildOutputDef_1.NAME]}`, 2); out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${yield gu.getVersionString()}`; out += mark.header("Analysis Results", 4); out += makeTableSummaryRaw(mark.toHeaderRow({ content: "Category", alignment: mark.ALIGN.LEFT }, { content: "Classes", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Fields", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }, { content: "Methods", alignment: mark.ALIGN.RIGHT }, { content: "in %", alignment: mark.ALIGN.RIGHT }), ...analysisResultsToTableRows(data[buildOutputDef_1.ANALYSIS_RESULTS])); @@ -68307,7 +70546,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; +exports.commentPR = exports.hRBytes = exports.getGVMversion = exports.setNativeImageOption = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; const c = __importStar(__nccwpck_require__(9042)); const gu_1 = __nccwpck_require__(5609); const core = __importStar(__nccwpck_require__(2186)); @@ -68319,6 +70558,8 @@ const core_1 = __nccwpck_require__(6762); const crypto_1 = __nccwpck_require__(6113); const path_1 = __nccwpck_require__(1017); const fs = __importStar(__nccwpck_require__(7147)); +const github = __importStar(__nccwpck_require__(5438)); +const options_1 = __nccwpck_require__(6159); // Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'; const GitHub = core_1.Octokit.defaults({ @@ -68340,7 +70581,7 @@ function exec(commandLine, args, options) { exports.exec = exec; function getLatestRelease(repo) { return __awaiter(this, void 0, void 0, function* () { - const githubToken = core.getInput('github-token'); + const githubToken = options_1.getGitHubToken(); const options = githubToken.length > 0 ? { auth: githubToken } : {}; const octokit = new GitHub(options); return (yield octokit.request('GET /repos/{owner}/{repo}/releases/latest', { @@ -68413,9 +70654,9 @@ function toSemVer(version) { return `${major}.${minor}.${patch}`; } function getNativeImageOptionsFile() { - let optionsFile = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + let optionsFile = process.env[c.ENV_NATIVE_IMAGE_CONFIG_FILE]; if (optionsFile === undefined) - core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + core.exportVariable(c.ENV_NATIVE_IMAGE_CONFIG_FILE, optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); return optionsFile; } function setNativeImageOption(value) { @@ -68455,6 +70696,16 @@ function hRBytes(bytes, decimals = 2) { return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } exports.hRBytes = hRBytes; +function commentPR(content) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + if (!options_1.isPrEvent()) + throw new Error("Not a PR event."); + const context = github.context; + yield github.getOctokit(options_1.getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content })); + }); +} +exports.commentPR = commentPR; /***/ }), diff --git a/package-lock.json b/package-lock.json index a46fe77..4d65ac3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@actions/cache": "^3.0.4", "@actions/core": "^1.6.0", "@actions/exec": "^1.1.0", + "@actions/github": "^5.1.1", "@actions/glob": "^0.3.0", "@actions/http-client": "^1.0.11", "@actions/io": "^1.1.1", @@ -103,6 +104,25 @@ "@actions/io": "^1.0.1" } }, + "node_modules/@actions/github": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.1.tgz", + "integrity": "sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==", + "dependencies": { + "@actions/http-client": "^2.0.1", + "@octokit/core": "^3.6.0", + "@octokit/plugin-paginate-rest": "^2.17.0", + "@octokit/plugin-rest-endpoint-methods": "^5.13.0" + } + }, + "node_modules/@actions/github/node_modules/@actions/http-client": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", + "dependencies": { + "tunnel": "^0.0.6" + } + }, "node_modules/@actions/glob": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", @@ -1482,6 +1502,29 @@ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "2.21.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", + "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", + "dependencies": { + "@octokit/types": "^6.40.0" + }, + "peerDependencies": { + "@octokit/core": ">=2" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", + "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", + "dependencies": { + "@octokit/types": "^6.39.0", + "deprecation": "^2.3.1" + }, + "peerDependencies": { + "@octokit/core": ">=3" + } + }, "node_modules/@octokit/request": { "version": "5.6.3", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", @@ -7030,6 +7073,27 @@ "@actions/io": "^1.0.1" } }, + "@actions/github": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.1.tgz", + "integrity": "sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==", + "requires": { + "@actions/http-client": "^2.0.1", + "@octokit/core": "^3.6.0", + "@octokit/plugin-paginate-rest": "^2.17.0", + "@octokit/plugin-rest-endpoint-methods": "^5.13.0" + }, + "dependencies": { + "@actions/http-client": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", + "requires": { + "tunnel": "^0.0.6" + } + } + } + }, "@actions/glob": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz", @@ -8136,6 +8200,23 @@ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" }, + "@octokit/plugin-paginate-rest": { + "version": "2.21.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", + "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", + "requires": { + "@octokit/types": "^6.40.0" + } + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.16.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", + "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", + "requires": { + "@octokit/types": "^6.39.0", + "deprecation": "^2.3.1" + } + }, "@octokit/request": { "version": "5.6.3", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", diff --git a/package.json b/package.json index 2c8b96a..d9912b5 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@actions/http-client": "^1.0.11", "@actions/io": "^1.1.1", "@actions/tool-cache": "^1.7.1", + "@actions/github": "^5.1.1", "@octokit/core": "^3.5.1", "@octokit/types": "^6.34.0", "uuid": "^8.3.2" diff --git a/src/cleanup.ts b/src/cleanup.ts index 16f031a..c2bf5f8 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -29,6 +29,7 @@ import * as constants from './constants' import { save } from './cache' import { createNIArtifactReport, createNIBuildReport } from './reports' import { isNativeImageBuildReport, isNativeImageArtifactReport, isPrReport, isJobReport } from './options' +import { commentPR } from './utils' /** * Check given input and run a save process for the specified package manager @@ -59,11 +60,16 @@ async function ignoreError(promise: Promise): Promise { export async function run(): Promise { + await outputReports(); + await ignoreError(saveCache()) +} + +async function outputReports() { let reported = false; if (await isNativeImageBuildReport()) { const report = await createNIBuildReport(); if (isPrReport()) { - + commentPR(report); } if (isJobReport()) { core.summary.addRaw(report); @@ -73,7 +79,7 @@ export async function run(): Promise { if (await isNativeImageArtifactReport()) { const report = createNIArtifactReport(); if (isPrReport()) { - + commentPR(report); } if (isJobReport()) { core.summary.addRaw(report); @@ -82,7 +88,6 @@ export async function run(): Promise { } if (reported) core.summary.write(); - await ignoreError(saveCache()) } if (require.main === module) { diff --git a/src/constants.ts b/src/constants.ts index fd30415..1ded783 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -30,8 +30,12 @@ export const MANDREL_NAMESPACE = 'mandrel-' export const GDS_BASE = 'https://gds.oracle.com/api/20220101' export const GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6' +export const ENV_NATIVE_IMAGE_CONFIG_FILE = 'NATIVE_IMAGE_CONFIG_FILE' export const NATIVE_IMAGE_OPTIONS_FILE = 'native-image-options.properties' +export const ENV_GITHUB_EVENT_NAME = "GITHUB_EVENT_NAME"; +export const EVENT_NAME_PULL_REQUEST = "pull_request"; + export type LatestReleaseResponse = otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response'] diff --git a/src/gu.ts b/src/gu.ts index 82a0564..f4bc69d 100644 --- a/src/gu.ts +++ b/src/gu.ts @@ -45,7 +45,10 @@ export async function setUpGUComponents( } } +let version: string; export async function getVersionString(): Promise { + if (version) + return version; let output = ""; const options: ExecOptions = { listeners: { @@ -56,5 +59,5 @@ export async function getVersionString(): Promise { }; await exec('gu', ['--version'], options); const versionParts = output.split(' '); - return versionParts[versionParts.length - 1]; + return version = versionParts[versionParts.length - 1]; } \ No newline at end of file diff --git a/src/options.ts b/src/options.ts index bdeb7a5..58138a7 100644 --- a/src/options.ts +++ b/src/options.ts @@ -12,7 +12,11 @@ export function isJobReport(): boolean { return core.getBooleanInput(c.INPUT_NI_REPORT_JOB); } export function isPrReport(): boolean { - return core.getBooleanInput(c.INPUT_NI_REPORT_PR); + return isPrEvent() && core.getBooleanInput(c.INPUT_NI_REPORT_PR); +} + +export function isPrEvent(): boolean { + return process.env[c.ENV_GITHUB_EVENT_NAME] === c.EVENT_NAME_PULL_REQUEST; } export async function isNativeImageArtifactReport(): Promise { @@ -21,6 +25,10 @@ export async function isNativeImageArtifactReport(): Promise { return correctVersion && isArtReport(); } -export function isArtReport():boolean{ +export function isArtReport(): boolean { return false;//core.getBooleanInput(c.INPUT_NI_REPORT_ARTIFACT); +} + +export function getGitHubToken(): string { + return core.getInput(c.INPUT_GITHUB_TOKEN); } \ No newline at end of file diff --git a/src/reports.ts b/src/reports.ts index ff5c79e..b60b290 100644 --- a/src/reports.ts +++ b/src/reports.ts @@ -23,7 +23,7 @@ const descend = (v1: Sized, v2: Sized) => v2.size - v1.size; const sum = (n1: number, n2: number) => n1 + n2; export function createNIArtifactReport(): string { - let out = ""; + let out = mark.header("Native Image Artifact Report", 1); const data: DashboardDump = JSON.parse(fs.readFileSync("artifactReport.dump").toString()); const heapBreakdown = data[HEAP_BREAKDOWN]; const codeBreakdown = data[CODE_BREAKDOWN]; @@ -64,7 +64,8 @@ function packagesToTable(pkgs: Package[]): string { export async function createNIBuildReport(): Promise { const data: BuildOutput = JSON.parse(fs.readFileSync("outputReport.json").toString()); - let out = mark.header(`Generated ${data[GENERAL_INFO][NAME]}`, 2); + let out = mark.header("Native Image Build Output Report", 1); + out += mark.header(`Generated ${data[GENERAL_INFO][NAME]}`, 2); out += `using ${mark.link("GraalVM Native Image", "https://www.graalvm.org/native-image/")} ${await gu.getVersionString()}` out += mark.header("Analysis Results", 4); diff --git a/src/utils.ts b/src/utils.ts index 6e7b99b..33d66f3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -9,6 +9,8 @@ import { Octokit } from '@octokit/core' import { createHash } from 'crypto' import { join } from 'path' import * as fs from 'fs' +import * as github from '@actions/github'; +import { getGitHubToken, isPrEvent } from './options'; // Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP) const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com' @@ -37,7 +39,7 @@ export async function exec( export async function getLatestRelease( repo: string ): Promise { - const githubToken = core.getInput('github-token') + const githubToken = getGitHubToken(); const options = githubToken.length > 0 ? { auth: githubToken } : {} const octokit = new GitHub(options) return ( @@ -116,9 +118,9 @@ function toSemVer(version: string): string { } function getNativeImageOptionsFile(): string { - let optionsFile: string | undefined = process.env["NATIVE_IMAGE_CONFIG_FILE"]; + let optionsFile: string | undefined = process.env[c.ENV_NATIVE_IMAGE_CONFIG_FILE]; if (optionsFile === undefined) - core.exportVariable("NATIVE_IMAGE_CONFIG_FILE", optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); + core.exportVariable(c.ENV_NATIVE_IMAGE_CONFIG_FILE, optionsFile = c.NATIVE_IMAGE_OPTIONS_FILE); return optionsFile; } @@ -152,4 +154,15 @@ export function hRBytes(bytes: number, decimals = 2): string { const dm = decimals < 0 ? 0 : decimals; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} + +export async function commentPR(content: string): Promise { + if (!isPrEvent()) + throw new Error("Not a PR event."); + const context = github.context; + await github.getOctokit(getGitHubToken()).rest.issues.createComment({ + ...context.repo, + issue_number: context.payload.pull_request?.number as number, + body: content, + }); } \ No newline at end of file