From e0220e141dc8f89cd0f1c60d0479f5167e9e3ddb Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Fri, 31 Oct 2025 17:19:10 +0100 Subject: [PATCH 01/22] #35162: Trying to post annotations a different way --- dist/index.js | 3846 +++++++++++++++++++++++++++------ dist/licenses.txt | 25 + src/action/decorate/action.ts | 8 +- src/github/annotations.ts | 62 +- src/github/interfaces.d.ts | 14 + 5 files changed, 3285 insertions(+), 670 deletions(-) diff --git a/dist/index.js b/dist/index.js index e2a2ce58..a979256b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45,6 +45,9 @@ const annotations_1 = __nccwpck_require__(7624); * @param analysisResult */ async function decorateAction(analysisResult, analysis) { + if (analysisResult && config_1.actionConfig.postAnnotations) { + await (0, annotations_1.postAnnotations)(analysisResult.projectResults); + } let summaryBody; if (analysisResult) { summaryBody = await (0, summary_1.createSummaryBody)(analysisResult); @@ -55,9 +58,6 @@ async function decorateAction(analysisResult, analysis) { if (config_1.githubConfig.event.isPullRequest) { await (0, pull_request_1.decoratePullRequest)(analysisResult?.passed ?? false, summaryBody); } - if (analysisResult && config_1.actionConfig.postAnnotations) { - (0, annotations_1.postAnnotations)(analysisResult.projectResults); - } } @@ -1446,30 +1446,48 @@ async function getPostedReviewComments() { * Deletes the review comments of previous runs. * @param postedReviewComments Previously posted review comments. */ -function postAnnotations(projectResults) { +async function postAnnotations(projectResults) { logger_1.logger.header('Posting annotations.'); - projectResults.forEach(projectResult => { - projectResult.annotations.forEach(annotation => { - if (annotation.postable) { - const title = annotation.msg; - const body = createReviewCommentBody(annotation); - if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { - logger_1.logger.warning(body, { - file: annotation.path, - startLine: annotation.line, - title: title - }); - } - else if (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) { - logger_1.logger.notice(body, { - file: annotation.path, - startLine: annotation.line, - title: title - }); - } - } - }); + const annotations = projectResults + .flatMap(projectResult => projectResult.annotations) + .filter(annotation => annotation.postable) + .map(annotation => { + const title = annotation.msg; + const body = createReviewCommentBody(annotation); + let level = 'warning'; + if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { + level = 'warning'; + } + else if (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) { + level = 'notice'; + } + return { + title: title, + message: body, + annotation_level: level, + path: annotation.path, + start_line: annotation.line, + end_line: annotation.line + }; }); + for (let i = 0; i < annotations.length; i += 50) { + const params = { + owner: config_1.githubConfig.owner, + repo: config_1.githubConfig.reponame, + check_run_id: config_1.githubConfig.runId, + output: { + summary: 'posting annotations...', + annotations: annotations.slice(i, i + 50) + } + }; + try { + await octokit_1.octokit.rest.checks.update(params); + } + catch (error) { + const message = (0, response_1.handleOctokitError)(error); + logger_1.logger.notice(`Could not post (some) annotations: ${message}`); + } + } logger_1.logger.info('Posted all postable annotations (none if there are no violations).'); } function createReviewCommentBody(annotation) { @@ -1944,28 +1962,28 @@ async function getChangedFilesOfPullRequestQL() { }; let response; try { - response = await octokit_1.octokit.graphql.paginate(`query changedFiles($owner: String!, $repo: String!, $pull_number: Int!, $per_page: Int!, $cursor: String) { - rateLimit { - remaining - } - repository(owner: $owner, name: $repo) { - pullRequest(number: $pull_number) { - files(first: $per_page, after: $cursor) { - totalCount - nodes { - path - changeType - additions - deletions - viewerViewedState - } - pageInfo { - hasNextPage - endCursor - } - } - } - } + response = await octokit_1.octokit.graphql.paginate(`query changedFiles($owner: String!, $repo: String!, $pull_number: Int!, $per_page: Int!, $cursor: String) { + rateLimit { + remaining + } + repository(owner: $owner, name: $repo) { + pullRequest(number: $pull_number) { + files(first: $per_page, after: $cursor) { + totalCount + nodes { + path + changeType + additions + deletions + viewerViewedState + } + pageInfo { + hasNextPage + endCursor + } + } + } + } }`, params); logger_1.logger.debug(JSON.stringify(response)); } @@ -5113,13 +5131,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.deleteArtifactPublic = deleteArtifactPublic; -exports.deleteArtifactInternal = deleteArtifactInternal; +exports.deleteArtifactInternal = exports.deleteArtifactPublic = void 0; const core_1 = __nccwpck_require__(37484); -const github_1 = __nccwpck_require__(93228); +const github_1 = __nccwpck_require__(29150); const user_agent_1 = __nccwpck_require__(89387); const retry_options_1 = __nccwpck_require__(38361); -const utils_1 = __nccwpck_require__(38006); +const utils_1 = __nccwpck_require__(97864); const plugin_request_log_1 = __nccwpck_require__(6966); const plugin_retry_1 = __nccwpck_require__(47164); const artifact_twirp_client_1 = __nccwpck_require__(87417); @@ -5128,8 +5145,8 @@ const generated_1 = __nccwpck_require__(44216); const get_artifact_1 = __nccwpck_require__(2327); const errors_1 = __nccwpck_require__(45655); function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { + var _a; return __awaiter(this, void 0, void 0, function* () { - var _a; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); const opts = { log: undefined, @@ -5153,6 +5170,7 @@ function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repo }; }); } +exports.deleteArtifactPublic = deleteArtifactPublic; function deleteArtifactInternal(artifactName) { return __awaiter(this, void 0, void 0, function* () { const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); @@ -5183,6 +5201,7 @@ function deleteArtifactInternal(artifactName) { }; }); } +exports.deleteArtifactInternal = deleteArtifactInternal; //# sourceMappingURL=delete-artifact.js.map /***/ }), @@ -5208,23 +5227,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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) { @@ -5238,13 +5247,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.streamExtractExternal = streamExtractExternal; -exports.downloadArtifactPublic = downloadArtifactPublic; -exports.downloadArtifactInternal = downloadArtifactInternal; +exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0; const promises_1 = __importDefault(__nccwpck_require__(91943)); const crypto = __importStar(__nccwpck_require__(76982)); const stream = __importStar(__nccwpck_require__(2203)); -const github = __importStar(__nccwpck_require__(93228)); +const github = __importStar(__nccwpck_require__(29150)); const core = __importStar(__nccwpck_require__(37484)); const httpClient = __importStar(__nccwpck_require__(54844)); const unzip_stream_1 = __importDefault(__nccwpck_require__(33991)); @@ -5292,21 +5299,20 @@ function streamExtract(url, directory) { throw new Error(`Artifact download failed after ${retryCount} retries.`); }); } -function streamExtractExternal(url_1, directory_1) { - return __awaiter(this, arguments, void 0, function* (url, directory, opts = { timeout: 30 * 1000 }) { +function streamExtractExternal(url, directory) { + return __awaiter(this, void 0, void 0, function* () { const client = new httpClient.HttpClient((0, user_agent_1.getUserAgentString)()); const response = yield client.get(url); if (response.message.statusCode !== 200) { throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); } + const timeout = 30 * 1000; // 30 seconds let sha256Digest = undefined; return new Promise((resolve, reject) => { const timerFn = () => { - const timeoutError = new Error(`Blob storage chunk did not respond in ${opts.timeout}ms`); - response.message.destroy(timeoutError); - reject(timeoutError); + response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`)); }; - const timer = setTimeout(timerFn, opts.timeout); + const timer = setTimeout(timerFn, timeout); const hashStream = crypto.createHash('sha256').setEncoding('hex'); const passThrough = new stream.PassThrough(); response.message.pipe(passThrough); @@ -5337,6 +5343,7 @@ function streamExtractExternal(url_1, directory_1) { }); }); } +exports.streamExtractExternal = streamExtractExternal; function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, token, options) { return __awaiter(this, void 0, void 0, function* () { const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path); @@ -5378,6 +5385,7 @@ function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, tok return { downloadPath, digestMismatch }; }); } +exports.downloadArtifactPublic = downloadArtifactPublic; function downloadArtifactInternal(artifactId, options) { return __awaiter(this, void 0, void 0, function* () { const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path); @@ -5421,8 +5429,9 @@ function downloadArtifactInternal(artifactId, options) { return { downloadPath, digestMismatch }; }); } -function resolveOrCreateDirectory() { - return __awaiter(this, arguments, void 0, function* (downloadPath = (0, config_1.getGitHubWorkspaceDir)()) { +exports.downloadArtifactInternal = downloadArtifactInternal; +function resolveOrCreateDirectory(downloadPath = (0, config_1.getGitHubWorkspaceDir)()) { + return __awaiter(this, void 0, void 0, function* () { if (!(yield exists(downloadPath))) { core.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`); yield promises_1.default.mkdir(downloadPath, { recursive: true }); @@ -5458,23 +5467,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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) { @@ -5485,12 +5484,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getArtifactPublic = getArtifactPublic; -exports.getArtifactInternal = getArtifactInternal; -const github_1 = __nccwpck_require__(93228); +exports.getArtifactInternal = exports.getArtifactPublic = void 0; +const github_1 = __nccwpck_require__(29150); const plugin_retry_1 = __nccwpck_require__(47164); const core = __importStar(__nccwpck_require__(37484)); -const utils_1 = __nccwpck_require__(38006); +const utils_1 = __nccwpck_require__(97864); const retry_options_1 = __nccwpck_require__(38361); const plugin_request_log_1 = __nccwpck_require__(6966); const util_1 = __nccwpck_require__(64012); @@ -5499,8 +5497,8 @@ const artifact_twirp_client_1 = __nccwpck_require__(87417); const generated_1 = __nccwpck_require__(44216); const errors_1 = __nccwpck_require__(45655); function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { + var _a; return __awaiter(this, void 0, void 0, function* () { - var _a; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); const opts = { log: undefined, @@ -5542,9 +5540,10 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit }; }); } +exports.getArtifactPublic = getArtifactPublic; function getArtifactInternal(artifactName) { + var _a; return __awaiter(this, void 0, void 0, function* () { - var _a; const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); const { workflowRunBackendId, workflowJobRunBackendId } = (0, util_1.getBackendIdsFromToken)(); const req = { @@ -5576,6 +5575,7 @@ function getArtifactInternal(artifactName) { }; }); } +exports.getArtifactInternal = getArtifactInternal; //# sourceMappingURL=get-artifact.js.map /***/ }), @@ -5595,24 +5595,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.listArtifactsPublic = listArtifactsPublic; -exports.listArtifactsInternal = listArtifactsInternal; +exports.listArtifactsInternal = exports.listArtifactsPublic = void 0; const core_1 = __nccwpck_require__(37484); -const github_1 = __nccwpck_require__(93228); +const github_1 = __nccwpck_require__(29150); const user_agent_1 = __nccwpck_require__(89387); const retry_options_1 = __nccwpck_require__(38361); -const utils_1 = __nccwpck_require__(38006); +const utils_1 = __nccwpck_require__(97864); const plugin_request_log_1 = __nccwpck_require__(6966); const plugin_retry_1 = __nccwpck_require__(47164); const artifact_twirp_client_1 = __nccwpck_require__(87417); const util_1 = __nccwpck_require__(64012); -const config_1 = __nccwpck_require__(72938); const generated_1 = __nccwpck_require__(44216); -const maximumArtifactCount = (0, config_1.getMaxArtifactListCount)(); +// Limiting to 1000 for perf reasons +const maximumArtifactCount = 1000; const paginationCount = 100; -const maxNumberOfPages = Math.ceil(maximumArtifactCount / paginationCount); -function listArtifactsPublic(workflowRunId_1, repositoryOwner_1, repositoryName_1, token_1) { - return __awaiter(this, arguments, void 0, function* (workflowRunId, repositoryOwner, repositoryName, token, latest = false) { +const maxNumberOfPages = maximumArtifactCount / paginationCount; +function listArtifactsPublic(workflowRunId, repositoryOwner, repositoryName, token, latest = false) { + return __awaiter(this, void 0, void 0, function* () { (0, core_1.info)(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`); let artifacts = []; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); @@ -5635,7 +5634,7 @@ function listArtifactsPublic(workflowRunId_1, repositoryOwner_1, repositoryName_ let numberOfPages = Math.ceil(listArtifactResponse.total_count / paginationCount); const totalArtifactCount = listArtifactResponse.total_count; if (totalArtifactCount > maximumArtifactCount) { - (0, core_1.warning)(`Workflow run ${workflowRunId} has ${totalArtifactCount} artifacts, exceeding the limit of ${maximumArtifactCount}. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`); + (0, core_1.warning)(`Workflow run ${workflowRunId} has more than 1000 artifacts. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`); numberOfPages = maxNumberOfPages; } // Iterate over the first page @@ -5653,7 +5652,7 @@ function listArtifactsPublic(workflowRunId_1, repositoryOwner_1, repositoryName_ // Move to the next page currentPageNumber++; // Iterate over any remaining pages - for (currentPageNumber; currentPageNumber <= numberOfPages; currentPageNumber++) { + for (currentPageNumber; currentPageNumber < numberOfPages; currentPageNumber++) { (0, core_1.debug)(`Fetching page ${currentPageNumber} of artifact list`); const { data: listArtifactResponse } = yield github.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts', { owner: repositoryOwner, @@ -5683,8 +5682,9 @@ function listArtifactsPublic(workflowRunId_1, repositoryOwner_1, repositoryName_ }; }); } -function listArtifactsInternal() { - return __awaiter(this, arguments, void 0, function* (latest = false) { +exports.listArtifactsPublic = listArtifactsPublic; +function listArtifactsInternal(latest = false) { + return __awaiter(this, void 0, void 0, function* () { const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); const { workflowRunBackendId, workflowJobRunBackendId } = (0, util_1.getBackendIdsFromToken)(); const req = { @@ -5713,6 +5713,7 @@ function listArtifactsInternal() { }; }); } +exports.listArtifactsInternal = listArtifactsInternal; /** * Filters a list of artifacts to only include the latest artifact for each name * @param artifacts The artifacts to filter @@ -5755,25 +5756,15 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getRetryOptions = getRetryOptions; +exports.getRetryOptions = void 0; const core = __importStar(__nccwpck_require__(37484)); // Defaults for fetching artifacts const defaultMaxRetryNumber = 5; @@ -5796,6 +5787,7 @@ function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exempt core.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a = retryOptions.doNotRetry) !== null && _a !== void 0 ? _a : 'octokit default: [400, 401, 403, 404, 422]'})`); return [retryOptions, requestOptions]; } +exports.getRetryOptions = getRetryOptions; //# sourceMappingURL=retry-options.js.map /***/ }), @@ -5815,7 +5807,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.internalArtifactTwirpClient = internalArtifactTwirpClient; +exports.internalArtifactTwirpClient = void 0; const http_client_1 = __nccwpck_require__(54844); const auth_1 = __nccwpck_require__(44552); const core_1 = __nccwpck_require__(37484); @@ -5956,6 +5948,7 @@ function internalArtifactTwirpClient(options) { const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); return new generated_1.ArtifactServiceClientJSON(client); } +exports.internalArtifactTwirpClient = internalArtifactTwirpClient; //# sourceMappingURL=artifact-twirp-client.js.map /***/ }), @@ -5969,14 +5962,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUploadChunkSize = getUploadChunkSize; -exports.getRuntimeToken = getRuntimeToken; -exports.getResultsServiceUrl = getResultsServiceUrl; -exports.isGhes = isGhes; -exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; -exports.getConcurrency = getConcurrency; -exports.getUploadChunkTimeout = getUploadChunkTimeout; -exports.getMaxArtifactListCount = getMaxArtifactListCount; +exports.getUploadChunkTimeout = exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; const os_1 = __importDefault(__nccwpck_require__(70857)); const core_1 = __nccwpck_require__(37484); // Used for controlling the highWaterMark value of the zip that is being streamed @@ -5984,6 +5970,7 @@ const core_1 = __nccwpck_require__(37484); function getUploadChunkSize() { return 8 * 1024 * 1024; // 8 MB Chunks } +exports.getUploadChunkSize = getUploadChunkSize; function getRuntimeToken() { const token = process.env['ACTIONS_RUNTIME_TOKEN']; if (!token) { @@ -5991,6 +5978,7 @@ function getRuntimeToken() { } return token; } +exports.getRuntimeToken = getRuntimeToken; function getResultsServiceUrl() { const resultsUrl = process.env['ACTIONS_RESULTS_URL']; if (!resultsUrl) { @@ -5998,6 +5986,7 @@ function getResultsServiceUrl() { } return new URL(resultsUrl).origin; } +exports.getResultsServiceUrl = getResultsServiceUrl; function isGhes() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const hostname = ghUrl.hostname.trimEnd().toUpperCase(); @@ -6006,6 +5995,7 @@ function isGhes() { const isLocalHost = hostname.endsWith('.LOCALHOST'); return !isGitHubHost && !isGheHost && !isLocalHost; } +exports.isGhes = isGhes; function getGitHubWorkspaceDir() { const ghWorkspaceDir = process.env['GITHUB_WORKSPACE']; if (!ghWorkspaceDir) { @@ -6013,6 +6003,7 @@ function getGitHubWorkspaceDir() { } return ghWorkspaceDir; } +exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; // The maximum value of concurrency is 300. // This value can be changed with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. function getConcurrency() { @@ -6038,6 +6029,7 @@ function getConcurrency() { // default concurrency to 5 return 5; } +exports.getConcurrency = getConcurrency; function getUploadChunkTimeout() { const timeoutVar = process.env['ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS']; if (!timeoutVar) { @@ -6049,16 +6041,7 @@ function getUploadChunkTimeout() { } return timeout; } -// This value can be changed with ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT variable. -// Defaults to 1000 as a safeguard for rate limiting. -function getMaxArtifactListCount() { - const maxCountVar = process.env['ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT'] || '1000'; - const maxCount = parseInt(maxCountVar); - if (isNaN(maxCount) || maxCount < 1) { - throw new Error('Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'); - } - return maxCount; -} +exports.getUploadChunkTimeout = getUploadChunkTimeout; //# sourceMappingURL=config.js.map /***/ }), @@ -6156,7 +6139,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUserAgentString = getUserAgentString; +exports.getUserAgentString = void 0; // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports const packageJson = __nccwpck_require__(2822); /** @@ -6165,6 +6148,7 @@ const packageJson = __nccwpck_require__(2822); function getUserAgentString() { return `@actions/artifact-${packageJson.version}`; } +exports.getUserAgentString = getUserAgentString; //# sourceMappingURL=user-agent.js.map /***/ }), @@ -6190,30 +6174,18 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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 __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getBackendIdsFromToken = getBackendIdsFromToken; -exports.maskSigUrl = maskSigUrl; -exports.maskSecretUrls = maskSecretUrls; +exports.maskSecretUrls = exports.maskSigUrl = exports.getBackendIdsFromToken = void 0; const core = __importStar(__nccwpck_require__(37484)); const config_1 = __nccwpck_require__(72938); const jwt_decode_1 = __importDefault(__nccwpck_require__(79699)); @@ -6265,6 +6237,7 @@ function getBackendIdsFromToken() { } throw InvalidJwtError; } +exports.getBackendIdsFromToken = getBackendIdsFromToken; /** * Masks the `sig` parameter in a URL and sets it as a secret. * @@ -6297,6 +6270,7 @@ function maskSigUrl(url) { (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); } } +exports.maskSigUrl = maskSigUrl; /** * Masks sensitive information in URLs containing signature parameters. * Currently supports masking 'sig' parameters in the 'signed_upload_url' @@ -6331,6 +6305,7 @@ function maskSecretUrls(body) { maskSigUrl(body.signed_url); } } +exports.maskSecretUrls = maskSecretUrls; //# sourceMappingURL=util.js.map /***/ }), @@ -6356,23 +6331,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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) { @@ -6383,7 +6348,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uploadZipToBlobStorage = uploadZipToBlobStorage; +exports.uploadZipToBlobStorage = void 0; const storage_blob_1 = __nccwpck_require__(1012); const config_1 = __nccwpck_require__(72938); const core = __importStar(__nccwpck_require__(37484)); @@ -6457,6 +6422,7 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { }; }); } +exports.uploadZipToBlobStorage = uploadZipToBlobStorage; //# sourceMappingURL=blob-upload.js.map /***/ }), @@ -6467,8 +6433,7 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.validateArtifactName = validateArtifactName; -exports.validateFilePath = validateFilePath; +exports.validateFilePath = exports.validateArtifactName = void 0; const core_1 = __nccwpck_require__(37484); /** * Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected @@ -6512,6 +6477,7 @@ These characters are not allowed in the artifact name due to limitations with ce } (0, core_1.info)(`Artifact name is valid!`); } +exports.validateArtifactName = validateArtifactName; /** * Validates file paths to check for any illegal characters that can cause problems on different file systems */ @@ -6530,6 +6496,7 @@ The following characters are not allowed in files that are uploaded due to limit } } } +exports.validateFilePath = validateFilePath; //# sourceMappingURL=path-and-artifact-name-validation.js.map /***/ }), @@ -6555,25 +6522,15 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getExpiration = getExpiration; +exports.getExpiration = void 0; const generated_1 = __nccwpck_require__(44216); const core = __importStar(__nccwpck_require__(37484)); function getExpiration(retentionDays) { @@ -6589,6 +6546,7 @@ function getExpiration(retentionDays) { expirationDate.setDate(expirationDate.getDate() + retentionDays); return generated_1.Timestamp.fromDate(expirationDate); } +exports.getExpiration = getExpiration; function getRetentionDays() { const retentionDays = process.env['GITHUB_RETENTION_DAYS']; if (!retentionDays) { @@ -6625,23 +6583,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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) { @@ -6652,7 +6600,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uploadArtifact = uploadArtifact; +exports.uploadArtifact = void 0; const core = __importStar(__nccwpck_require__(37484)); const retention_1 = __nccwpck_require__(47252); const path_and_artifact_name_validation_1 = __nccwpck_require__(89190); @@ -6720,6 +6668,7 @@ function uploadArtifact(name, files, rootDirectory, options) { }; }); } +exports.uploadArtifact = uploadArtifact; //# sourceMappingURL=upload-artifact.js.map /***/ }), @@ -6745,26 +6694,15 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.validateRootDirectory = validateRootDirectory; -exports.getUploadZipSpecification = getUploadZipSpecification; +exports.getUploadZipSpecification = exports.validateRootDirectory = void 0; const fs = __importStar(__nccwpck_require__(79896)); const core_1 = __nccwpck_require__(37484); const path_1 = __nccwpck_require__(16928); @@ -6782,6 +6720,7 @@ function validateRootDirectory(rootDirectory) { } (0, core_1.info)(`Root directory input is valid!`); } +exports.validateRootDirectory = validateRootDirectory; /** * Creates a specification that describes how a zip file will be created for a set of input files * @param filesToZip a list of file that should be included in the zip @@ -6852,6 +6791,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) { } return specification; } +exports.getUploadZipSpecification = getUploadZipSpecification; //# sourceMappingURL=upload-zip-specification.js.map /***/ }), @@ -6877,23 +6817,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : function(o, v) { o["default"] = v; }); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); +var __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) { @@ -6904,8 +6834,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ZipUploadStream = exports.DEFAULT_COMPRESSION_LEVEL = void 0; -exports.createZipUploadStream = createZipUploadStream; +exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRESSION_LEVEL = void 0; const stream = __importStar(__nccwpck_require__(2203)); const promises_1 = __nccwpck_require__(91943); const archiver = __importStar(__nccwpck_require__(99392)); @@ -6926,8 +6855,8 @@ class ZipUploadStream extends stream.Transform { } } exports.ZipUploadStream = ZipUploadStream; -function createZipUploadStream(uploadSpecification_1) { - return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) { +function createZipUploadStream(uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) { + return __awaiter(this, void 0, void 0, function* () { core.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`); const zip = archiver.create('zip', { highWaterMark: (0, config_1.getUploadChunkSize)(), @@ -6964,6 +6893,7 @@ function createZipUploadStream(uploadSpecification_1) { return zipUploadStream; }); } +exports.createZipUploadStream = createZipUploadStream; // eslint-disable-next-line @typescript-eslint/no-explicit-any const zipErrorCallback = (error) => { core.error('An error has occurred while creating the zip file for upload'); @@ -6989,6 +6919,2321 @@ const zipEndCallback = () => { }; //# sourceMappingURL=zip.js.map +/***/ }), + +/***/ 27466: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Context = void 0; +const fs_1 = __nccwpck_require__(79896); +const os_1 = __nccwpck_require__(70857); +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 + +/***/ }), + +/***/ 29150: +/***/ (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__(27466)); +const utils_1 = __nccwpck_require__(97864); +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 + +/***/ }), + +/***/ 14970: +/***/ (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__(54844)); +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 + +/***/ }), + +/***/ 97864: +/***/ (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__(27466)); +const Utils = __importStar(__nccwpck_require__(14970)); +// octokit + plugins +const core_1 = __nccwpck_require__(62647); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(47477); +const plugin_paginate_rest_1 = __nccwpck_require__(85060); +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 + +/***/ }), + +/***/ 62646: +/***/ ((__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 + + +/***/ }), + +/***/ 62647: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var universalUserAgent = __nccwpck_require__(33843); +var beforeAfterHook = __nccwpck_require__(52732); +var request = __nccwpck_require__(4085); +var graphql = __nccwpck_require__(43165); +var authToken = __nccwpck_require__(62646); + +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 + + +/***/ }), + +/***/ 28421: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var isPlainObject = __nccwpck_require__(93407); +var universalUserAgent = __nccwpck_require__(33843); + +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 + + +/***/ }), + +/***/ 43165: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var request = __nccwpck_require__(4085); +var universalUserAgent = __nccwpck_require__(33843); + +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 + + +/***/ }), + +/***/ 85060: +/***/ ((__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 + + +/***/ }), + +/***/ 47477: +/***/ ((__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 + + /***/ }), /***/ 47164: @@ -7073,6 +9318,273 @@ exports.retry = retry; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 4085: +/***/ ((__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__(28421); +var universalUserAgent = __nccwpck_require__(33843); +var isPlainObject = __nccwpck_require__(93407); +var nodeFetch = _interopDefault(__nccwpck_require__(26705)); +var requestError = __nccwpck_require__(67477); + +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 + }); + } + + 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; + } + + 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 + + +/***/ }), + +/***/ 67477: +/***/ ((__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__(14150); +var once = _interopDefault(__nccwpck_require__(55560)); + +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 + + /***/ }), /***/ 44914: @@ -86501,6 +89013,52 @@ exports.possibleElisions = possibleElisions; }(); // eslint-disable-line +/***/ }), + +/***/ 93407: +/***/ ((__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; + + /***/ }), /***/ 96543: @@ -198585,6 +201143,378 @@ function cleanEscapedString(input) { } +/***/ }), + +/***/ 27633: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.parseISO = parseISO; +var _index = __nccwpck_require__(46104); + +var _index2 = __nccwpck_require__(25848); +var _index3 = __nccwpck_require__(44826); + +/** + * The {@link parseISO} function options. + */ + +/** + * @name parseISO + * @category Common Helpers + * @summary Parse ISO string + * + * @description + * Parse the given string in ISO 8601 format and return an instance of Date. + * + * Function accepts complete ISO 8601 formats as well as partial implementations. + * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 + * + * If the argument isn't a string, the function cannot parse the string or + * the values are invalid, it returns Invalid Date. + * + * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param argument - The value to convert + * @param options - An object with options + * + * @returns The parsed date in the local time zone + * + * @example + * // Convert string '2014-02-11T11:30:30' to date: + * const result = parseISO('2014-02-11T11:30:30') + * //=> Tue Feb 11 2014 11:30:30 + * + * @example + * // Convert string '+02014101' to date, + * // if the additional number of digits in the extended year format is 1: + * const result = parseISO('+02014101', { additionalDigits: 1 }) + * //=> Fri Apr 11 2014 00:00:00 + */ +function parseISO(argument, options) { + const invalidDate = () => (0, _index2.constructFrom)(options?.in, NaN); + + const additionalDigits = options?.additionalDigits ?? 2; + const dateStrings = splitDateString(argument); + + let date; + if (dateStrings.date) { + const parseYearResult = parseYear(dateStrings.date, additionalDigits); + date = parseDate(parseYearResult.restDateString, parseYearResult.year); + } + + if (!date || isNaN(+date)) return invalidDate(); + + const timestamp = +date; + let time = 0; + let offset; + + if (dateStrings.time) { + time = parseTime(dateStrings.time); + if (isNaN(time)) return invalidDate(); + } + + if (dateStrings.timezone) { + offset = parseTimezone(dateStrings.timezone); + if (isNaN(offset)) return invalidDate(); + } else { + const tmpDate = new Date(timestamp + time); + const result = (0, _index3.toDate)(0, options?.in); + result.setFullYear( + tmpDate.getUTCFullYear(), + tmpDate.getUTCMonth(), + tmpDate.getUTCDate(), + ); + result.setHours( + tmpDate.getUTCHours(), + tmpDate.getUTCMinutes(), + tmpDate.getUTCSeconds(), + tmpDate.getUTCMilliseconds(), + ); + return result; + } + + return (0, _index3.toDate)(timestamp + time + offset, options?.in); +} + +const patterns = { + dateTimeDelimiter: /[T ]/, + timeZoneDelimiter: /[Z ]/i, + timezone: /([Z+-].*)$/, +}; + +const dateRegex = + /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; +const timeRegex = + /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; +const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; + +function splitDateString(dateString) { + const dateStrings = {}; + const array = dateString.split(patterns.dateTimeDelimiter); + let timeString; + + // The regex match should only return at maximum two array elements. + // [date], [time], or [date, time]. + if (array.length > 2) { + return dateStrings; + } + + if (/:/.test(array[0])) { + timeString = array[0]; + } else { + dateStrings.date = array[0]; + timeString = array[1]; + if (patterns.timeZoneDelimiter.test(dateStrings.date)) { + dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; + timeString = dateString.substr( + dateStrings.date.length, + dateString.length, + ); + } + } + + if (timeString) { + const token = patterns.timezone.exec(timeString); + if (token) { + dateStrings.time = timeString.replace(token[1], ""); + dateStrings.timezone = token[1]; + } else { + dateStrings.time = timeString; + } + } + + return dateStrings; +} + +function parseYear(dateString, additionalDigits) { + const regex = new RegExp( + "^(?:(\\d{4}|[+-]\\d{" + + (4 + additionalDigits) + + "})|(\\d{2}|[+-]\\d{" + + (2 + additionalDigits) + + "})$)", + ); + + const captures = dateString.match(regex); + // Invalid ISO-formatted year + if (!captures) return { year: NaN, restDateString: "" }; + + const year = captures[1] ? parseInt(captures[1]) : null; + const century = captures[2] ? parseInt(captures[2]) : null; + + // either year or century is null, not both + return { + year: century === null ? year : century * 100, + restDateString: dateString.slice((captures[1] || captures[2]).length), + }; +} + +function parseDate(dateString, year) { + // Invalid ISO-formatted year + if (year === null) return new Date(NaN); + + const captures = dateString.match(dateRegex); + // Invalid ISO-formatted string + if (!captures) return new Date(NaN); + + const isWeekDate = !!captures[4]; + const dayOfYear = parseDateUnit(captures[1]); + const month = parseDateUnit(captures[2]) - 1; + const day = parseDateUnit(captures[3]); + const week = parseDateUnit(captures[4]); + const dayOfWeek = parseDateUnit(captures[5]) - 1; + + if (isWeekDate) { + if (!validateWeekDate(year, week, dayOfWeek)) { + return new Date(NaN); + } + return dayOfISOWeekYear(year, week, dayOfWeek); + } else { + const date = new Date(0); + if ( + !validateDate(year, month, day) || + !validateDayOfYearDate(year, dayOfYear) + ) { + return new Date(NaN); + } + date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); + return date; + } +} + +function parseDateUnit(value) { + return value ? parseInt(value) : 1; +} + +function parseTime(timeString) { + const captures = timeString.match(timeRegex); + if (!captures) return NaN; // Invalid ISO-formatted time + + const hours = parseTimeUnit(captures[1]); + const minutes = parseTimeUnit(captures[2]); + const seconds = parseTimeUnit(captures[3]); + + if (!validateTime(hours, minutes, seconds)) { + return NaN; + } + + return ( + hours * _index.millisecondsInHour + + minutes * _index.millisecondsInMinute + + seconds * 1000 + ); +} + +function parseTimeUnit(value) { + return (value && parseFloat(value.replace(",", "."))) || 0; +} + +function parseTimezone(timezoneString) { + if (timezoneString === "Z") return 0; + + const captures = timezoneString.match(timezoneRegex); + if (!captures) return 0; + + const sign = captures[1] === "+" ? -1 : 1; + const hours = parseInt(captures[2]); + const minutes = (captures[3] && parseInt(captures[3])) || 0; + + if (!validateTimezone(hours, minutes)) { + return NaN; + } + + return ( + sign * + (hours * _index.millisecondsInHour + minutes * _index.millisecondsInMinute) + ); +} + +function dayOfISOWeekYear(isoWeekYear, week, day) { + const date = new Date(0); + date.setUTCFullYear(isoWeekYear, 0, 4); + const fourthOfJanuaryDay = date.getUTCDay() || 7; + const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; + date.setUTCDate(date.getUTCDate() + diff); + return date; +} + +// Validation functions + +// February is null to handle the leap year (using ||) +const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +function isLeapYearIndex(year) { + return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); +} + +function validateDate(year, month, date) { + return ( + month >= 0 && + month <= 11 && + date >= 1 && + date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) + ); +} + +function validateDayOfYearDate(year, dayOfYear) { + return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); +} + +function validateWeekDate(_year, week, day) { + return week >= 1 && week <= 53 && day >= 0 && day <= 6; +} + +function validateTime(hours, minutes, seconds) { + if (hours === 24) { + return minutes === 0 && seconds === 0; + } + + return ( + seconds >= 0 && + seconds < 60 && + minutes >= 0 && + minutes < 60 && + hours >= 0 && + hours < 25 + ); +} + +function validateTimezone(_hours, minutes) { + return minutes >= 0 && minutes <= 59; +} + + +/***/ }), + +/***/ 26380: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +exports.parseJSON = parseJSON; +var _index = __nccwpck_require__(44826); + +/** + * The {@link parseJSON} function options. + */ + +/** + * Converts a complete ISO date string in UTC time, the typical format for transmitting + * a date in JSON, to a JavaScript `Date` instance. + * + * This is a minimal implementation for converting dates retrieved from a JSON API to + * a `Date` instance which can be used with other functions in the `date-fns` library. + * The following formats are supported: + * + * - `2000-03-15T05:20:10.123Z`: The output of `.toISOString()` and `JSON.stringify(new Date())` + * - `2000-03-15T05:20:10Z`: Without milliseconds + * - `2000-03-15T05:20:10+00:00`: With a zero offset, the default JSON encoded format in some other languages + * - `2000-03-15T05:20:10+05:45`: With a positive or negative offset, the default JSON encoded format in some other languages + * - `2000-03-15T05:20:10+0000`: With a zero offset without a colon + * - `2000-03-15T05:20:10`: Without a trailing 'Z' symbol + * - `2000-03-15T05:20:10.1234567`: Up to 7 digits in milliseconds field. Only first 3 are taken into account since JS does not allow fractional milliseconds + * - `2000-03-15 05:20:10`: With a space instead of a 'T' separator for APIs returning a SQL date without reformatting + * + * For convenience and ease of use these other input types are also supported + * via [toDate](https://date-fns.org/docs/toDate): + * + * - A `Date` instance will be cloned + * - A `number` will be treated as a timestamp + * + * Any other input type or invalid date strings will return an `Invalid Date`. + * + * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. + * + * @param dateStr - A fully formed ISO8601 date string to convert + * @param options - An object with options + * + * @returns The parsed date in the local time zone + */ +function parseJSON(dateStr, options) { + const parts = dateStr.match( + /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/, + ); + + if (!parts) return (0, _index.toDate)(NaN, options?.in); + + return (0, _index.toDate)( + Date.UTC( + +parts[1], + +parts[2] - 1, + +parts[3], + +parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1), + +parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1), + +parts[6], + +((parts[7] || "0") + "00").substring(0, 3), + ), + options?.in, + ); +} + + /***/ }), /***/ 29861: @@ -201117,378 +204047,6 @@ function isLeapYearIndex(year) { } -/***/ }), - -/***/ 27633: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -exports.parseISO = parseISO; -var _index = __nccwpck_require__(46104); - -var _index2 = __nccwpck_require__(25848); -var _index3 = __nccwpck_require__(44826); - -/** - * The {@link parseISO} function options. - */ - -/** - * @name parseISO - * @category Common Helpers - * @summary Parse ISO string - * - * @description - * Parse the given string in ISO 8601 format and return an instance of Date. - * - * Function accepts complete ISO 8601 formats as well as partial implementations. - * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 - * - * If the argument isn't a string, the function cannot parse the string or - * the values are invalid, it returns Invalid Date. - * - * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). - * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. - * - * @param argument - The value to convert - * @param options - An object with options - * - * @returns The parsed date in the local time zone - * - * @example - * // Convert string '2014-02-11T11:30:30' to date: - * const result = parseISO('2014-02-11T11:30:30') - * //=> Tue Feb 11 2014 11:30:30 - * - * @example - * // Convert string '+02014101' to date, - * // if the additional number of digits in the extended year format is 1: - * const result = parseISO('+02014101', { additionalDigits: 1 }) - * //=> Fri Apr 11 2014 00:00:00 - */ -function parseISO(argument, options) { - const invalidDate = () => (0, _index2.constructFrom)(options?.in, NaN); - - const additionalDigits = options?.additionalDigits ?? 2; - const dateStrings = splitDateString(argument); - - let date; - if (dateStrings.date) { - const parseYearResult = parseYear(dateStrings.date, additionalDigits); - date = parseDate(parseYearResult.restDateString, parseYearResult.year); - } - - if (!date || isNaN(+date)) return invalidDate(); - - const timestamp = +date; - let time = 0; - let offset; - - if (dateStrings.time) { - time = parseTime(dateStrings.time); - if (isNaN(time)) return invalidDate(); - } - - if (dateStrings.timezone) { - offset = parseTimezone(dateStrings.timezone); - if (isNaN(offset)) return invalidDate(); - } else { - const tmpDate = new Date(timestamp + time); - const result = (0, _index3.toDate)(0, options?.in); - result.setFullYear( - tmpDate.getUTCFullYear(), - tmpDate.getUTCMonth(), - tmpDate.getUTCDate(), - ); - result.setHours( - tmpDate.getUTCHours(), - tmpDate.getUTCMinutes(), - tmpDate.getUTCSeconds(), - tmpDate.getUTCMilliseconds(), - ); - return result; - } - - return (0, _index3.toDate)(timestamp + time + offset, options?.in); -} - -const patterns = { - dateTimeDelimiter: /[T ]/, - timeZoneDelimiter: /[Z ]/i, - timezone: /([Z+-].*)$/, -}; - -const dateRegex = - /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; -const timeRegex = - /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; -const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; - -function splitDateString(dateString) { - const dateStrings = {}; - const array = dateString.split(patterns.dateTimeDelimiter); - let timeString; - - // The regex match should only return at maximum two array elements. - // [date], [time], or [date, time]. - if (array.length > 2) { - return dateStrings; - } - - if (/:/.test(array[0])) { - timeString = array[0]; - } else { - dateStrings.date = array[0]; - timeString = array[1]; - if (patterns.timeZoneDelimiter.test(dateStrings.date)) { - dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; - timeString = dateString.substr( - dateStrings.date.length, - dateString.length, - ); - } - } - - if (timeString) { - const token = patterns.timezone.exec(timeString); - if (token) { - dateStrings.time = timeString.replace(token[1], ""); - dateStrings.timezone = token[1]; - } else { - dateStrings.time = timeString; - } - } - - return dateStrings; -} - -function parseYear(dateString, additionalDigits) { - const regex = new RegExp( - "^(?:(\\d{4}|[+-]\\d{" + - (4 + additionalDigits) + - "})|(\\d{2}|[+-]\\d{" + - (2 + additionalDigits) + - "})$)", - ); - - const captures = dateString.match(regex); - // Invalid ISO-formatted year - if (!captures) return { year: NaN, restDateString: "" }; - - const year = captures[1] ? parseInt(captures[1]) : null; - const century = captures[2] ? parseInt(captures[2]) : null; - - // either year or century is null, not both - return { - year: century === null ? year : century * 100, - restDateString: dateString.slice((captures[1] || captures[2]).length), - }; -} - -function parseDate(dateString, year) { - // Invalid ISO-formatted year - if (year === null) return new Date(NaN); - - const captures = dateString.match(dateRegex); - // Invalid ISO-formatted string - if (!captures) return new Date(NaN); - - const isWeekDate = !!captures[4]; - const dayOfYear = parseDateUnit(captures[1]); - const month = parseDateUnit(captures[2]) - 1; - const day = parseDateUnit(captures[3]); - const week = parseDateUnit(captures[4]); - const dayOfWeek = parseDateUnit(captures[5]) - 1; - - if (isWeekDate) { - if (!validateWeekDate(year, week, dayOfWeek)) { - return new Date(NaN); - } - return dayOfISOWeekYear(year, week, dayOfWeek); - } else { - const date = new Date(0); - if ( - !validateDate(year, month, day) || - !validateDayOfYearDate(year, dayOfYear) - ) { - return new Date(NaN); - } - date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); - return date; - } -} - -function parseDateUnit(value) { - return value ? parseInt(value) : 1; -} - -function parseTime(timeString) { - const captures = timeString.match(timeRegex); - if (!captures) return NaN; // Invalid ISO-formatted time - - const hours = parseTimeUnit(captures[1]); - const minutes = parseTimeUnit(captures[2]); - const seconds = parseTimeUnit(captures[3]); - - if (!validateTime(hours, minutes, seconds)) { - return NaN; - } - - return ( - hours * _index.millisecondsInHour + - minutes * _index.millisecondsInMinute + - seconds * 1000 - ); -} - -function parseTimeUnit(value) { - return (value && parseFloat(value.replace(",", "."))) || 0; -} - -function parseTimezone(timezoneString) { - if (timezoneString === "Z") return 0; - - const captures = timezoneString.match(timezoneRegex); - if (!captures) return 0; - - const sign = captures[1] === "+" ? -1 : 1; - const hours = parseInt(captures[2]); - const minutes = (captures[3] && parseInt(captures[3])) || 0; - - if (!validateTimezone(hours, minutes)) { - return NaN; - } - - return ( - sign * - (hours * _index.millisecondsInHour + minutes * _index.millisecondsInMinute) - ); -} - -function dayOfISOWeekYear(isoWeekYear, week, day) { - const date = new Date(0); - date.setUTCFullYear(isoWeekYear, 0, 4); - const fourthOfJanuaryDay = date.getUTCDay() || 7; - const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; -} - -// Validation functions - -// February is null to handle the leap year (using ||) -const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - -function isLeapYearIndex(year) { - return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); -} - -function validateDate(year, month, date) { - return ( - month >= 0 && - month <= 11 && - date >= 1 && - date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) - ); -} - -function validateDayOfYearDate(year, dayOfYear) { - return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); -} - -function validateWeekDate(_year, week, day) { - return week >= 1 && week <= 53 && day >= 0 && day <= 6; -} - -function validateTime(hours, minutes, seconds) { - if (hours === 24) { - return minutes === 0 && seconds === 0; - } - - return ( - seconds >= 0 && - seconds < 60 && - minutes >= 0 && - minutes < 60 && - hours >= 0 && - hours < 25 - ); -} - -function validateTimezone(_hours, minutes) { - return minutes >= 0 && minutes <= 59; -} - - -/***/ }), - -/***/ 26380: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -exports.parseJSON = parseJSON; -var _index = __nccwpck_require__(44826); - -/** - * The {@link parseJSON} function options. - */ - -/** - * Converts a complete ISO date string in UTC time, the typical format for transmitting - * a date in JSON, to a JavaScript `Date` instance. - * - * This is a minimal implementation for converting dates retrieved from a JSON API to - * a `Date` instance which can be used with other functions in the `date-fns` library. - * The following formats are supported: - * - * - `2000-03-15T05:20:10.123Z`: The output of `.toISOString()` and `JSON.stringify(new Date())` - * - `2000-03-15T05:20:10Z`: Without milliseconds - * - `2000-03-15T05:20:10+00:00`: With a zero offset, the default JSON encoded format in some other languages - * - `2000-03-15T05:20:10+05:45`: With a positive or negative offset, the default JSON encoded format in some other languages - * - `2000-03-15T05:20:10+0000`: With a zero offset without a colon - * - `2000-03-15T05:20:10`: Without a trailing 'Z' symbol - * - `2000-03-15T05:20:10.1234567`: Up to 7 digits in milliseconds field. Only first 3 are taken into account since JS does not allow fractional milliseconds - * - `2000-03-15 05:20:10`: With a space instead of a 'T' separator for APIs returning a SQL date without reformatting - * - * For convenience and ease of use these other input types are also supported - * via [toDate](https://date-fns.org/docs/toDate): - * - * - A `Date` instance will be cloned - * - A `number` will be treated as a timestamp - * - * Any other input type or invalid date strings will return an `Invalid Date`. - * - * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. - * - * @param dateStr - A fully formed ISO8601 date string to convert - * @param options - An object with options - * - * @returns The parsed date in the local time zone - */ -function parseJSON(dateStr, options) { - const parts = dateStr.match( - /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/, - ); - - if (!parts) return (0, _index.toDate)(NaN, options?.in); - - return (0, _index.toDate)( - Date.UTC( - +parts[1], - +parts[2] - 1, - +parts[3], - +parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1), - +parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1), - +parts[6], - +((parts[7] || "0") + "00").substring(0, 3), - ), - options?.in, - ); -} - - /***/ }), /***/ 80144: @@ -204567,7 +207125,7 @@ function yearsToQuarters(years) { /***/ ((module) => { "use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/artifact","version":"4.0.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^6.0.1","@actions/http-client":"^2.1.0","@azure/core-http":"^3.0.5","@azure/storage-blob":"^12.15.0","@octokit/core":"^5.2.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request":"^8.4.1","@octokit/request-error":"^5.1.1","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.28.13","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}'); +module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/artifact","version":"2.3.2","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); /***/ }), diff --git a/dist/licenses.txt b/dist/licenses.txt index c1966ceb..3b403ed8 100644 --- a/dist/licenses.txt +++ b/dist/licenses.txt @@ -2490,6 +2490,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +is-plain-object +MIT +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + is-stream MIT MIT License diff --git a/src/action/decorate/action.ts b/src/action/decorate/action.ts index 8a09f8eb..b4df3f18 100644 --- a/src/action/decorate/action.ts +++ b/src/action/decorate/action.ts @@ -10,6 +10,10 @@ import { Analysis, AnalysisResult } from '../../helper/interfaces'; * @param analysisResult */ export async function decorateAction(analysisResult: AnalysisResult | undefined, analysis: Analysis): Promise { + if (analysisResult && actionConfig.postAnnotations) { + await postAnnotations(analysisResult.projectResults); + } + let summaryBody; if (analysisResult) { summaryBody = await createSummaryBody(analysisResult); @@ -20,8 +24,4 @@ export async function decorateAction(analysisResult: AnalysisResult | undefined, if (githubConfig.event.isPullRequest) { await decoratePullRequest(analysisResult?.passed ?? false, summaryBody); } - - if (analysisResult && actionConfig.postAnnotations) { - postAnnotations(analysisResult.projectResults); - } } diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 66c54c0b..fc3c43cf 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -1,4 +1,4 @@ -import { ReviewComment } from './interfaces'; +import { AnnotationLevel, GithubAnnotation, ReviewComment } from './interfaces'; import { logger } from '../helper/logger'; import { ProjectResult } from '../helper/interfaces'; import { handleOctokitError } from '../helper/response'; @@ -38,31 +38,49 @@ export async function getPostedReviewComments(): Promise { * Deletes the review comments of previous runs. * @param postedReviewComments Previously posted review comments. */ -export function postAnnotations(projectResults: ProjectResult[]): void { +export async function postAnnotations(projectResults: ProjectResult[]): Promise { logger.header('Posting annotations.'); - projectResults.forEach(projectResult => { - projectResult.annotations.forEach(annotation => { - if (annotation.postable) { - const title = annotation.msg; - const body = createReviewCommentBody(annotation); - - if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { - logger.warning(body, { - file: annotation.path, - startLine: annotation.line, - title: title - }); - } else if (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) { - logger.notice(body, { - file: annotation.path, - startLine: annotation.line, - title: title - }); - } + const annotations: GithubAnnotation[] = projectResults + .flatMap(projectResult => projectResult.annotations) + .filter(annotation => annotation.postable) + .map(annotation => { + const title = annotation.msg; + const body = createReviewCommentBody(annotation); + let level: AnnotationLevel = 'warning'; + if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { + level = 'warning'; + } else if (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) { + level = 'notice'; } + return { + title: title, + message: body, + annotation_level: level, + path: annotation.path, + start_line: annotation.line, + end_line: annotation.line + }; }); - }); + + for (let i = 0; i < annotations.length; i += 50) { + const params = { + owner: githubConfig.owner, + repo: githubConfig.reponame, + check_run_id: githubConfig.runId, + output: { + summary: 'posting annotations...', + annotations: annotations.slice(i, i + 50) + } + }; + + try { + await octokit.rest.checks.update(params); + } catch (error) { + const message = handleOctokitError(error); + logger.notice(`Could not post (some) annotations: ${message}`); + } + } logger.info('Posted all postable annotations (none if there are no violations).'); } diff --git a/src/github/interfaces.d.ts b/src/github/interfaces.d.ts index d11d15bf..b8755b09 100644 --- a/src/github/interfaces.d.ts +++ b/src/github/interfaces.d.ts @@ -1,4 +1,5 @@ import { PullRequestChangedFile } from '@octokit/graphql-schema'; +import { ExtendedAnnotation } from '../viewer/interfaces'; type Side = 'LEFT' | 'RIGHT'; type AuthorAssociation = 'COLLABORATOR' | 'CONTRIBUTOR' | 'FIRST_TIMER' | 'FIRST_TIME_CONTRIBUTOR' | 'MANNEQUIN' | 'MEMBER' | 'NONE' | 'OWNER'; @@ -168,3 +169,16 @@ export interface ActionOutput { conditions: string[]; annotations: ExtendedAnnotation[]; } + +export type AnnotationLevel = 'notice' | 'warning' | 'failure'; +export interface GithubAnnotation { + path: string; + start_line: number; + end_line: number; + start_column?: number; + end_column?: number; + annotation_level: AnnotationLevel; + message: string; + title?: string; + raw_details?: string; +} From e1362ee29c6d81d4f0e9ee825322ae0a7d858034 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:30:01 +0100 Subject: [PATCH 02/22] #35162: Posting annotations in a new check run --- dist/index.js | 9 +++++++-- src/github/annotations.ts | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index a979256b..74cb942a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1474,14 +1474,19 @@ async function postAnnotations(projectResults) { const params = { owner: config_1.githubConfig.owner, repo: config_1.githubConfig.reponame, - check_run_id: config_1.githubConfig.runId, output: { + title: 'TICS annotations', summary: 'posting annotations...', annotations: annotations.slice(i, i + 50) } }; try { - await octokit_1.octokit.rest.checks.update(params); + if (i === 0) { + await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations' }); + } + else { + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); + } } catch (error) { const message = (0, response_1.handleOctokitError)(error); diff --git a/src/github/annotations.ts b/src/github/annotations.ts index fc3c43cf..aecf1ac2 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -67,15 +67,19 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< const params = { owner: githubConfig.owner, repo: githubConfig.reponame, - check_run_id: githubConfig.runId, output: { + title: 'TICS annotations', summary: 'posting annotations...', annotations: annotations.slice(i, i + 50) } }; try { - await octokit.rest.checks.update(params); + if (i === 0) { + await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations' }); + } else { + await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); + } } catch (error) { const message = handleOctokitError(error); logger.notice(`Could not post (some) annotations: ${message}`); From a32f2195b2d7c6df5f66f7fe713013e1ff6c4131 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:39:32 +0100 Subject: [PATCH 03/22] #35162: Completing the check run with the last annotations post --- dist/index.js | 11 ++++++++--- src/github/annotations.ts | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 74cb942a..1c2456e1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1481,11 +1481,16 @@ async function postAnnotations(projectResults) { } }; try { - if (i === 0) { - await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations' }); + if (i === 0 && i + 50 < annotations.length) { + await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations', status: 'in_progress' }); } else { - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); + if (i + 50 >= annotations.length) { + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId, status: 'completed' }); + } + else { + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); + } } } catch (error) { diff --git a/src/github/annotations.ts b/src/github/annotations.ts index aecf1ac2..0f4f4a6e 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -75,10 +75,14 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< }; try { - if (i === 0) { - await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations' }); + if (i === 0 && i + 50 < annotations.length) { + await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations', status: 'in_progress' }); } else { - await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); + if (i + 50 >= annotations.length) { + await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, status: 'completed' }); + } else { + await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); + } } } catch (error) { const message = handleOctokitError(error); From 891d68ca6ecb713f1af735d8f83202ef1e052de8 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:44:10 +0100 Subject: [PATCH 04/22] #35162: Fixed mistake where no check run was created --- dist/index.js | 9 +++++++-- src/github/annotations.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1c2456e1..072ecbb8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1481,8 +1481,13 @@ async function postAnnotations(projectResults) { } }; try { - if (i === 0 && i + 50 < annotations.length) { - await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations', status: 'in_progress' }); + if (i === 0) { + await octokit_1.octokit.rest.checks.create({ + ...params, + head_sha: config_1.githubConfig.commitSha, + name: 'TICS annotations', + status: i + 50 >= annotations.length ? 'completed' : 'in_progress' + }); } else { if (i + 50 >= annotations.length) { diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 0f4f4a6e..cfef7cb3 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -75,8 +75,13 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< }; try { - if (i === 0 && i + 50 < annotations.length) { - await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations', status: 'in_progress' }); + if (i === 0) { + await octokit.rest.checks.create({ + ...params, + head_sha: githubConfig.commitSha, + name: 'TICS annotations', + status: i + 50 >= annotations.length ? 'completed' : 'in_progress' + }); } else { if (i + 50 >= annotations.length) { await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, status: 'completed' }); From c78746b2f20d09e2f64d5ba24311cba30e299212 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:50:09 +0100 Subject: [PATCH 05/22] #35162: Added conclusion in case of last run --- dist/index.js | 5 +++-- src/github/annotations.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 072ecbb8..412070e9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1486,12 +1486,13 @@ async function postAnnotations(projectResults) { ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations', - status: i + 50 >= annotations.length ? 'completed' : 'in_progress' + conclusion: i + 50 >= annotations.length ? 'success' : undefined, + status: i + 50 >= annotations.length ? undefined : 'in_progress' }); } else { if (i + 50 >= annotations.length) { - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId, status: 'completed' }); + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId, conclusion: 'success' }); } else { await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); diff --git a/src/github/annotations.ts b/src/github/annotations.ts index cfef7cb3..559d29a6 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -80,11 +80,12 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations', - status: i + 50 >= annotations.length ? 'completed' : 'in_progress' + conclusion: i + 50 >= annotations.length ? 'success' : undefined, + status: i + 50 >= annotations.length ? undefined : 'in_progress' }); } else { if (i + 50 >= annotations.length) { - await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, status: 'completed' }); + await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, conclusion: 'success' }); } else { await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); } From 4ff35164bbefa66f8ecd119b45d3fab7fa9c0857 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:01:29 +0100 Subject: [PATCH 06/22] #35162: Passing TICS env to process, also added some debug logging --- dist/index.js | 6 ++++++ src/github/annotations.ts | 3 +++ src/tics/analyzer.ts | 3 +++ 3 files changed, 12 insertions(+) diff --git a/dist/index.js b/dist/index.js index 412070e9..245e6092 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1482,6 +1482,7 @@ async function postAnnotations(projectResults) { }; try { if (i === 0) { + logger_1.logger.debug('Creating check run with: ' + JSON.stringify(params)); await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, @@ -1492,9 +1493,11 @@ async function postAnnotations(projectResults) { } else { if (i + 50 >= annotations.length) { + logger_1.logger.debug('Updating check run with: ' + JSON.stringify(params)); await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId, conclusion: 'success' }); } else { + logger_1.logger.debug('Updating check run with: ' + JSON.stringify(params)); await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); } } @@ -2530,6 +2533,9 @@ async function runTicsAnalyzer(fileListPath) { findInStdOutOrErr(filtered); } } + }, + env: { + TICS: config_1.ticsConfig.viewerUrl } }); completed = true; diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 559d29a6..a39f19ce 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -76,6 +76,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< try { if (i === 0) { + logger.debug('Creating check run with: ' + JSON.stringify(params)); await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, @@ -85,8 +86,10 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< }); } else { if (i + 50 >= annotations.length) { + logger.debug('Updating check run with: ' + JSON.stringify(params)); await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, conclusion: 'success' }); } else { + logger.debug('Updating check run with: ' + JSON.stringify(params)); await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); } } diff --git a/src/tics/analyzer.ts b/src/tics/analyzer.ts index 5cbdf9c3..8c879379 100644 --- a/src/tics/analyzer.ts +++ b/src/tics/analyzer.ts @@ -46,6 +46,9 @@ export async function runTicsAnalyzer(fileListPath: string): Promise { findInStdOutOrErr(filtered); } } + }, + env: { + TICS: ticsConfig.viewerUrl } }); completed = true; From 483836804d0910b6ae1839e2c549cfce3e6106b6 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:04:33 +0100 Subject: [PATCH 07/22] #35162: Removed last addition of adding TICS env to process --- dist/index.js | 3 --- src/tics/analyzer.ts | 3 --- 2 files changed, 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 245e6092..1473c50d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2533,9 +2533,6 @@ async function runTicsAnalyzer(fileListPath) { findInStdOutOrErr(filtered); } } - }, - env: { - TICS: config_1.ticsConfig.viewerUrl } }); completed = true; diff --git a/src/tics/analyzer.ts b/src/tics/analyzer.ts index 8c879379..5cbdf9c3 100644 --- a/src/tics/analyzer.ts +++ b/src/tics/analyzer.ts @@ -46,9 +46,6 @@ export async function runTicsAnalyzer(fileListPath: string): Promise { findInStdOutOrErr(filtered); } } - }, - env: { - TICS: ticsConfig.viewerUrl } }); completed = true; From 5bc017a549023bcef2b90e8199d78e548d3b0c88 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:23:40 +0100 Subject: [PATCH 08/22] #35162: Added more debug logging --- dist/index.js | 21 ++++++++++++++------ src/github/annotations.ts | 40 ++++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1473c50d..f65a1b04 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1470,6 +1470,7 @@ async function postAnnotations(projectResults) { end_line: annotation.line }; }); + let checkRunId = 0; for (let i = 0; i < annotations.length; i += 50) { const params = { owner: config_1.githubConfig.owner, @@ -1482,23 +1483,31 @@ async function postAnnotations(projectResults) { }; try { if (i === 0) { - logger_1.logger.debug('Creating check run with: ' + JSON.stringify(params)); - await octokit_1.octokit.rest.checks.create({ + logger_1.logger.debug('Creating check run with: ' + + JSON.stringify({ + ...params, + head_sha: config_1.githubConfig.commitSha, + name: 'TICS annotations', + conclusion: i + 50 >= annotations.length ? 'success' : undefined, + status: i + 50 >= annotations.length ? undefined : 'in_progress' + })); + const response = await octokit_1.octokit.rest.checks.create({ ...params, head_sha: config_1.githubConfig.commitSha, name: 'TICS annotations', conclusion: i + 50 >= annotations.length ? 'success' : undefined, status: i + 50 >= annotations.length ? undefined : 'in_progress' }); + checkRunId = response.data.id; } else { if (i + 50 >= annotations.length) { - logger_1.logger.debug('Updating check run with: ' + JSON.stringify(params)); - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId, conclusion: 'success' }); + logger_1.logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId, conclusion: 'success' })); + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: checkRunId, conclusion: 'success' }); } else { - logger_1.logger.debug('Updating check run with: ' + JSON.stringify(params)); - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: config_1.githubConfig.runId }); + logger_1.logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId })); + await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: checkRunId }); } } } diff --git a/src/github/annotations.ts b/src/github/annotations.ts index a39f19ce..6d90ce10 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -34,6 +34,21 @@ export async function getPostedReviewComments(): Promise { return response; } +interface CheckRunParams { + owner: string; + repo: string; + head_sha?: string; + name?: string; + status?: 'in_progress' | 'queued' | 'completed'; + conclusion?: 'failure' | 'success' | 'action_required' | 'cancelled' | 'neutral' | 'skipped' | 'stale' | 'timed_out'; + check_run_id?: number; + output: { + title: string; + summary: string; + annotations: GithubAnnotation[]; + }; +} + /** * Deletes the review comments of previous runs. * @param postedReviewComments Previously posted review comments. @@ -63,8 +78,9 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< }; }); + let checkRunId = 0; for (let i = 0; i < annotations.length; i += 50) { - const params = { + const params: CheckRunParams = { owner: githubConfig.owner, repo: githubConfig.reponame, output: { @@ -76,21 +92,31 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< try { if (i === 0) { - logger.debug('Creating check run with: ' + JSON.stringify(params)); - await octokit.rest.checks.create({ + logger.debug( + 'Creating check run with: ' + + JSON.stringify({ + ...params, + head_sha: githubConfig.commitSha, + name: 'TICS annotations', + conclusion: i + 50 >= annotations.length ? 'success' : undefined, + status: i + 50 >= annotations.length ? undefined : 'in_progress' + }) + ); + const response = await octokit.rest.checks.create({ ...params, head_sha: githubConfig.commitSha, name: 'TICS annotations', conclusion: i + 50 >= annotations.length ? 'success' : undefined, status: i + 50 >= annotations.length ? undefined : 'in_progress' }); + checkRunId = response.data.id; } else { if (i + 50 >= annotations.length) { - logger.debug('Updating check run with: ' + JSON.stringify(params)); - await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId, conclusion: 'success' }); + logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId, conclusion: 'success' })); + await octokit.rest.checks.update({ ...params, check_run_id: checkRunId, conclusion: 'success' }); } else { - logger.debug('Updating check run with: ' + JSON.stringify(params)); - await octokit.rest.checks.update({ ...params, check_run_id: githubConfig.runId }); + logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId })); + await octokit.rest.checks.update({ ...params, check_run_id: checkRunId }); } } } catch (error) { From a43bc9d339a829a7074a8b0fc6c955b30ad13a59 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:52:43 +0100 Subject: [PATCH 09/22] #35162: Trying to get the commit sha a different way --- dist/index.js | 12 +++++++++++- src/configuration/github.ts | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f65a1b04..5532ef02 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1020,8 +1020,8 @@ class GithubConfig { this.apiUrl = github_1.context.apiUrl; this.owner = github_1.context.repo.owner; this.reponame = github_1.context.repo.repo; - this.commitSha = github_1.context.sha; this.event = this.getGithubEvent(); + this.commitSha = this.getCommitSha(); this.job = github_1.context.job.replace(/[\s|_]+/g, '-'); this.action = github_1.context.action.replace('__tiobe_', ''); this.workflow = github_1.context.workflow.replace(/[\s|_]+/g, '-'); @@ -1073,6 +1073,16 @@ class GithubConfig { return github_event_1.GithubEvent.PUSH; } } + getCommitSha() { + // Should run after getGithubEvent + if (this.event.isPullRequest) { + const pr = github_1.context.payload.pull_request; + return pr.head.sha; + } + else { + return github_1.context.sha; + } + } getCommentIdentifier() { return [this.workflow, this.job, this.runNumber, this.runAttempt].join('_'); } diff --git a/src/configuration/github.ts b/src/configuration/github.ts index a0e733a5..9190017d 100644 --- a/src/configuration/github.ts +++ b/src/configuration/github.ts @@ -24,8 +24,8 @@ export class GithubConfig { this.apiUrl = context.apiUrl; this.owner = context.repo.owner; this.reponame = context.repo.repo; - this.commitSha = context.sha; this.event = this.getGithubEvent(); + this.commitSha = this.getCommitSha(); this.job = context.job.replace(/[\s|_]+/g, '-'); this.action = context.action.replace('__tiobe_', ''); this.workflow = context.workflow.replace(/[\s|_]+/g, '-'); @@ -80,6 +80,20 @@ export class GithubConfig { } } + private getCommitSha() { + // Should run after getGithubEvent + if (this.event.isPullRequest) { + const pr = context.payload.pull_request as { + head: { sha: string }; + base: { ref: string }; + number: number; + }; + return pr.head.sha; + } else { + return context.sha; + } + } + getCommentIdentifier(): string { return [this.workflow, this.job, this.runNumber, this.runAttempt].join('_'); } From fa9f1e657d6eac4351d9836796e093894196ce13 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:00:44 +0100 Subject: [PATCH 10/22] #35162: Fixed issue with retrieving changed files created by last commit --- dist/index.js | 13 ++++++++++--- src/configuration/github.ts | 13 +++++++------ src/github/annotations.ts | 6 +++++- src/github/commits.ts | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5532ef02..176f2001 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1004,6 +1004,8 @@ class GithubConfig { apiUrl; owner; reponame; + sha; + // Sha of the underlying commit that triggered the flow commitSha; event; job; @@ -1020,6 +1022,7 @@ class GithubConfig { this.apiUrl = github_1.context.apiUrl; this.owner = github_1.context.repo.owner; this.reponame = github_1.context.repo.repo; + this.sha = github_1.context.sha; this.event = this.getGithubEvent(); this.commitSha = this.getCommitSha(); this.job = github_1.context.job.replace(/[\s|_]+/g, '-'); @@ -1077,7 +1080,7 @@ class GithubConfig { // Should run after getGithubEvent if (this.event.isPullRequest) { const pr = github_1.context.payload.pull_request; - return pr.head.sha; + return pr.head?.sha; } else { return github_1.context.sha; @@ -1458,6 +1461,10 @@ async function getPostedReviewComments() { */ async function postAnnotations(projectResults) { logger_1.logger.header('Posting annotations.'); + if (!config_1.githubConfig.commitSha) { + logger_1.logger.warning('Commit of underlying commit not found, cannot post annotations'); + return; + } const annotations = projectResults .flatMap(projectResult => projectResult.annotations) .filter(annotation => annotation.postable) @@ -1487,7 +1494,7 @@ async function postAnnotations(projectResults) { repo: config_1.githubConfig.reponame, output: { title: 'TICS annotations', - summary: 'posting annotations...', + summary: '', annotations: annotations.slice(i, i + 50) } }; @@ -1811,7 +1818,7 @@ async function getChangedFilesOfCommit() { const params = { owner: config_1.githubConfig.owner, repo: config_1.githubConfig.reponame, - ref: config_1.githubConfig.commitSha + ref: config_1.githubConfig.sha }; let response = []; try { diff --git a/src/configuration/github.ts b/src/configuration/github.ts index 9190017d..4c0f6930 100644 --- a/src/configuration/github.ts +++ b/src/configuration/github.ts @@ -7,7 +7,9 @@ export class GithubConfig { readonly apiUrl: string; readonly owner: string; readonly reponame: string; - readonly commitSha: string; + readonly sha: string; + // Sha of the underlying commit that triggered the flow + readonly commitSha: string | undefined; readonly event: GithubEvent; readonly job: string; readonly action: string; @@ -24,6 +26,7 @@ export class GithubConfig { this.apiUrl = context.apiUrl; this.owner = context.repo.owner; this.reponame = context.repo.repo; + this.sha = context.sha; this.event = this.getGithubEvent(); this.commitSha = this.getCommitSha(); this.job = context.job.replace(/[\s|_]+/g, '-'); @@ -80,15 +83,13 @@ export class GithubConfig { } } - private getCommitSha() { + private getCommitSha(): string | undefined { // Should run after getGithubEvent if (this.event.isPullRequest) { const pr = context.payload.pull_request as { - head: { sha: string }; - base: { ref: string }; - number: number; + head?: { sha?: string }; }; - return pr.head.sha; + return pr.head?.sha; } else { return context.sha; } diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 6d90ce10..a5775d54 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -55,6 +55,10 @@ interface CheckRunParams { */ export async function postAnnotations(projectResults: ProjectResult[]): Promise { logger.header('Posting annotations.'); + if (!githubConfig.commitSha) { + logger.warning('Commit of underlying commit not found, cannot post annotations'); + return; + } const annotations: GithubAnnotation[] = projectResults .flatMap(projectResult => projectResult.annotations) @@ -85,7 +89,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< repo: githubConfig.reponame, output: { title: 'TICS annotations', - summary: 'posting annotations...', + summary: '', annotations: annotations.slice(i, i + 50) } }; diff --git a/src/github/commits.ts b/src/github/commits.ts index 41deaefd..910dde14 100644 --- a/src/github/commits.ts +++ b/src/github/commits.ts @@ -15,7 +15,7 @@ export async function getChangedFilesOfCommit(): Promise { const params = { owner: githubConfig.owner, repo: githubConfig.reponame, - ref: githubConfig.commitSha + ref: githubConfig.sha }; let response: ChangedFile[] = []; try { From d41af68143894758318a31e7c2a5af7cff7348d1 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:15:38 +0100 Subject: [PATCH 11/22] #35162: Cleaned up code --- dist/index.js | 37 ++++++++++++---------------- src/configuration/github.ts | 13 +++++----- src/github/annotations.ts | 48 ++++++++++--------------------------- src/github/interfaces.d.ts | 4 ++++ 4 files changed, 37 insertions(+), 65 deletions(-) diff --git a/dist/index.js b/dist/index.js index 176f2001..3242ce65 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1005,8 +1005,8 @@ class GithubConfig { owner; reponame; sha; - // Sha of the underlying commit that triggered the flow - commitSha; + // Sha of the (underlying) commit that triggered the flow + headSha; event; job; action; @@ -1024,7 +1024,7 @@ class GithubConfig { this.reponame = github_1.context.repo.repo; this.sha = github_1.context.sha; this.event = this.getGithubEvent(); - this.commitSha = this.getCommitSha(); + this.headSha = this.getHeadSha(); this.job = github_1.context.job.replace(/[\s|_]+/g, '-'); this.action = github_1.context.action.replace('__tiobe_', ''); this.workflow = github_1.context.workflow.replace(/[\s|_]+/g, '-'); @@ -1076,10 +1076,11 @@ class GithubConfig { return github_event_1.GithubEvent.PUSH; } } - getCommitSha() { + getHeadSha() { // Should run after getGithubEvent if (this.event.isPullRequest) { const pr = github_1.context.payload.pull_request; + logger_1.logger.debug(`Found pull_request.head.sha: ${pr.head?.sha ?? 'undefined'}`); return pr.head?.sha; } else { @@ -1461,7 +1462,7 @@ async function getPostedReviewComments() { */ async function postAnnotations(projectResults) { logger_1.logger.header('Posting annotations.'); - if (!config_1.githubConfig.commitSha) { + if (!config_1.githubConfig.headSha) { logger_1.logger.warning('Commit of underlying commit not found, cannot post annotations'); return; } @@ -1500,32 +1501,24 @@ async function postAnnotations(projectResults) { }; try { if (i === 0) { - logger_1.logger.debug('Creating check run with: ' + - JSON.stringify({ - ...params, - head_sha: config_1.githubConfig.commitSha, - name: 'TICS annotations', - conclusion: i + 50 >= annotations.length ? 'success' : undefined, - status: i + 50 >= annotations.length ? undefined : 'in_progress' - })); - const response = await octokit_1.octokit.rest.checks.create({ + const pars = { ...params, - head_sha: config_1.githubConfig.commitSha, + head_sha: config_1.githubConfig.headSha, name: 'TICS annotations', conclusion: i + 50 >= annotations.length ? 'success' : undefined, status: i + 50 >= annotations.length ? undefined : 'in_progress' - }); + }; + logger_1.logger.debug('Creating check run with: ' + JSON.stringify(pars)); + const response = await octokit_1.octokit.rest.checks.create(pars); checkRunId = response.data.id; } else { + const pars = { ...params, check_run_id: checkRunId }; if (i + 50 >= annotations.length) { - logger_1.logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId, conclusion: 'success' })); - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: checkRunId, conclusion: 'success' }); - } - else { - logger_1.logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId })); - await octokit_1.octokit.rest.checks.update({ ...params, check_run_id: checkRunId }); + pars.conclusion = 'success'; } + logger_1.logger.debug('Updating check run with: ' + JSON.stringify(pars)); + await octokit_1.octokit.rest.checks.update(pars); } } catch (error) { diff --git a/src/configuration/github.ts b/src/configuration/github.ts index 4c0f6930..5adb4a28 100644 --- a/src/configuration/github.ts +++ b/src/configuration/github.ts @@ -8,8 +8,8 @@ export class GithubConfig { readonly owner: string; readonly reponame: string; readonly sha: string; - // Sha of the underlying commit that triggered the flow - readonly commitSha: string | undefined; + // Sha of the (underlying) commit that triggered the flow + readonly headSha: string | undefined; readonly event: GithubEvent; readonly job: string; readonly action: string; @@ -28,7 +28,7 @@ export class GithubConfig { this.reponame = context.repo.repo; this.sha = context.sha; this.event = this.getGithubEvent(); - this.commitSha = this.getCommitSha(); + this.headSha = this.getHeadSha(); this.job = context.job.replace(/[\s|_]+/g, '-'); this.action = context.action.replace('__tiobe_', ''); this.workflow = context.workflow.replace(/[\s|_]+/g, '-'); @@ -83,12 +83,11 @@ export class GithubConfig { } } - private getCommitSha(): string | undefined { + private getHeadSha(): string | undefined { // Should run after getGithubEvent if (this.event.isPullRequest) { - const pr = context.payload.pull_request as { - head?: { sha?: string }; - }; + const pr = context.payload.pull_request as { head?: { sha?: string } }; + logger.debug(`Found pull_request.head.sha: ${pr.head?.sha ?? 'undefined'}`); return pr.head?.sha; } else { return context.sha; diff --git a/src/github/annotations.ts b/src/github/annotations.ts index a5775d54..d9d89e30 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -1,4 +1,4 @@ -import { AnnotationLevel, GithubAnnotation, ReviewComment } from './interfaces'; +import { AnnotationLevel, CreateCheckRunParams, GithubAnnotation, ReviewComment, UpdateCheckRunParams } from './interfaces'; import { logger } from '../helper/logger'; import { ProjectResult } from '../helper/interfaces'; import { handleOctokitError } from '../helper/response'; @@ -34,28 +34,13 @@ export async function getPostedReviewComments(): Promise { return response; } -interface CheckRunParams { - owner: string; - repo: string; - head_sha?: string; - name?: string; - status?: 'in_progress' | 'queued' | 'completed'; - conclusion?: 'failure' | 'success' | 'action_required' | 'cancelled' | 'neutral' | 'skipped' | 'stale' | 'timed_out'; - check_run_id?: number; - output: { - title: string; - summary: string; - annotations: GithubAnnotation[]; - }; -} - /** * Deletes the review comments of previous runs. * @param postedReviewComments Previously posted review comments. */ export async function postAnnotations(projectResults: ProjectResult[]): Promise { logger.header('Posting annotations.'); - if (!githubConfig.commitSha) { + if (!githubConfig.headSha) { logger.warning('Commit of underlying commit not found, cannot post annotations'); return; } @@ -84,7 +69,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< let checkRunId = 0; for (let i = 0; i < annotations.length; i += 50) { - const params: CheckRunParams = { + const params = { owner: githubConfig.owner, repo: githubConfig.reponame, output: { @@ -96,32 +81,23 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< try { if (i === 0) { - logger.debug( - 'Creating check run with: ' + - JSON.stringify({ - ...params, - head_sha: githubConfig.commitSha, - name: 'TICS annotations', - conclusion: i + 50 >= annotations.length ? 'success' : undefined, - status: i + 50 >= annotations.length ? undefined : 'in_progress' - }) - ); - const response = await octokit.rest.checks.create({ + const pars: CreateCheckRunParams = { ...params, - head_sha: githubConfig.commitSha, + head_sha: githubConfig.headSha, name: 'TICS annotations', conclusion: i + 50 >= annotations.length ? 'success' : undefined, status: i + 50 >= annotations.length ? undefined : 'in_progress' - }); + }; + logger.debug('Creating check run with: ' + JSON.stringify(pars)); + const response = await octokit.rest.checks.create(pars); checkRunId = response.data.id; } else { + const pars: UpdateCheckRunParams = { ...params, check_run_id: checkRunId }; if (i + 50 >= annotations.length) { - logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId, conclusion: 'success' })); - await octokit.rest.checks.update({ ...params, check_run_id: checkRunId, conclusion: 'success' }); - } else { - logger.debug('Updating check run with: ' + JSON.stringify({ ...params, check_run_id: checkRunId })); - await octokit.rest.checks.update({ ...params, check_run_id: checkRunId }); + pars.conclusion = 'success'; } + logger.debug('Updating check run with: ' + JSON.stringify(pars)); + await octokit.rest.checks.update(pars); } } catch (error) { const message = handleOctokitError(error); diff --git a/src/github/interfaces.d.ts b/src/github/interfaces.d.ts index b8755b09..a702f729 100644 --- a/src/github/interfaces.d.ts +++ b/src/github/interfaces.d.ts @@ -1,4 +1,5 @@ import { PullRequestChangedFile } from '@octokit/graphql-schema'; +import { Endpoints } from '@octokit/types'; import { ExtendedAnnotation } from '../viewer/interfaces'; type Side = 'LEFT' | 'RIGHT'; @@ -182,3 +183,6 @@ export interface GithubAnnotation { title?: string; raw_details?: string; } + +export type CreateCheckRunParams = Endpoints['POST /repos/{owner}/{repo}/check-runs']['parameters']; +export type UpdateCheckRunParams = Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']; From 3eab7f073af248d3b5c554958500e05b5d99d36b Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:07:16 +0100 Subject: [PATCH 12/22] #35162: Added the option to include non-blocking issues when posting annotations --- README.md | 27 ++++++++++++++------------- action.yaml | 4 ++++ dist/index.js | 13 +++++++++++-- src/configuration/action.ts | 2 ++ src/github/annotations.ts | 7 ++++++- src/viewer/annotations.ts | 7 +++++-- 6 files changed, 42 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e591c87d..ecb74afe 100644 --- a/README.md +++ b/README.md @@ -164,11 +164,12 @@ The following options allow to instrument TICSQServer more specifically: Below are some special parameters that can be used to control how the GitHub Action posts its results: -| Input | Description | Default | -| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `postAnnotations` | Show the TICS violations in the changed files window. Options are `true` or `false`. | `true` | -| `postToConversation` | Post the summary to the conversation page of the pull request. | `true` | -| `pullRequestApproval` | Set the plugin to approve or deny a pull request, by default this is false. Options are `true` or `false`. Note that once a run that added a reviewer has been completed, this reviewer cannot be deleted from that pull request. (Always the case on versions between TICS GitHub Action 2.0.0 and 2.5.0). | `false` | +| Input | Description | Default | +| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `postAnnotations` | Show the TICS violations in the changed files window. Options are `true` or `false`. | `true` | +| `includeNonBlockingAnnotations` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | +| `postToConversation` | Post the summary to the conversation page of the pull request. | `true` | +| `pullRequestApproval` | Set the plugin to approve or deny a pull request, by default this is false. Options are `true` or `false`. Note that once a run that added a reviewer has been completed, this reviewer cannot be deleted from that pull request. (Always the case on versions between TICS GitHub Action 2.0.0 and 2.5.0). | `false` | ### Infrastructural and Security related parameters @@ -210,14 +211,14 @@ jobs: It is possible to retrieve all Quality Gate conditions and reported annotations in JSON format. To do this add an id to the step: ```yaml - - name: TICS GitHub Action - id: tics-github-action - uses: tiobe/tics-github-action@v3 - with: - mode: diagnostic - viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config - ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} - installTics: true +- name: TICS GitHub Action + id: tics-github-action + uses: tiobe/tics-github-action@v3 + with: + mode: diagnostic + viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config + ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} + installTics: true ``` This can then be used in following steps with `{{ steps.tics-github-action.outputs.annotations }}`. diff --git a/action.yaml b/action.yaml index d58e59f8..22ec4a14 100644 --- a/action.yaml +++ b/action.yaml @@ -67,6 +67,10 @@ inputs: description: Show the TICS violations in the changed files window. Options are `true` or `false` (default is `true`). required: false default: true + includeNonBlockingAnnotations: + description: Include non-blocking TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `false`). + required: false + default: false postToConversation: description: Post the summary to the conversation page of the pull request. Options are `true` (default) or `false`. required: false diff --git a/dist/index.js b/dist/index.js index 3242ce65..e8bd5dce 100644 --- a/dist/index.js +++ b/dist/index.js @@ -881,6 +881,7 @@ const logger_1 = __nccwpck_require__(66113); class ActionConfiguration { excludeMovedFiles; postAnnotations; + includeNonBlockingAnnotations; postToConversation; pullRequestApproval; retryConfig; @@ -889,6 +890,7 @@ class ActionConfiguration { constructor() { this.excludeMovedFiles = (0, core_1.getBooleanInput)('excludeMovedFiles'); this.postAnnotations = (0, core_1.getBooleanInput)('postAnnotations'); + this.includeNonBlockingAnnotations = (0, core_1.getBooleanInput)('includeNonBlockingAnnotations'); this.postToConversation = (0, core_1.getBooleanInput)('postToConversation'); this.pullRequestApproval = (0, core_1.getBooleanInput)('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig((0, core_1.getInput)('retryCodes')); @@ -1488,6 +1490,10 @@ async function postAnnotations(projectResults) { end_line: annotation.line }; }); + if (annotations.length === 0) { + logger_1.logger.info('No annotations to post.'); + return; + } let checkRunId = 0; for (let i = 0; i < annotations.length; i += 50) { const params = { @@ -1526,7 +1532,7 @@ async function postAnnotations(projectResults) { logger_1.logger.notice(`Could not post (some) annotations: ${message}`); } } - logger_1.logger.info('Posted all postable annotations (none if there are no violations).'); + logger_1.logger.info('Posted all postable annotations'); } function createReviewCommentBody(annotation) { let body = ''; @@ -2822,7 +2828,10 @@ async function fetchAnnotationsWithApiLinks(apiLinks) { } async function fetchAnnotationsByRun(identifier) { const annotationsUrl = new URL(`${config_1.ticsConfig.baseUrl}/api/public/v1/Annotations?metric=QualityGate()`); - let filters = `Project(${identifier.project}),AnnotationSeverity(Set(blocking,after))`; + let filters = `Project(${identifier.project})`; + if (!config_1.actionConfig.includeNonBlockingAnnotations) { + filters += ',AnnotationSeverity(Set(blocking,after))'; + } if (identifier.cdtoken) { filters += `,ClientData(${identifier.cdtoken})`; } diff --git a/src/configuration/action.ts b/src/configuration/action.ts index d3df4466..f771f906 100644 --- a/src/configuration/action.ts +++ b/src/configuration/action.ts @@ -7,6 +7,7 @@ import { logger } from '../helper/logger'; export class ActionConfiguration { readonly excludeMovedFiles: boolean; readonly postAnnotations: boolean; + readonly includeNonBlockingAnnotations: boolean; readonly postToConversation: boolean; readonly pullRequestApproval: boolean; readonly retryConfig: RetryConfig; @@ -16,6 +17,7 @@ export class ActionConfiguration { constructor() { this.excludeMovedFiles = getBooleanInput('excludeMovedFiles'); this.postAnnotations = getBooleanInput('postAnnotations'); + this.includeNonBlockingAnnotations = getBooleanInput('includeNonBlockingAnnotations'); this.postToConversation = getBooleanInput('postToConversation'); this.pullRequestApproval = getBooleanInput('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig(getInput('retryCodes')); diff --git a/src/github/annotations.ts b/src/github/annotations.ts index d9d89e30..c46b3d1d 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -67,6 +67,11 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< }; }); + if (annotations.length === 0) { + logger.info('No annotations to post.'); + return; + } + let checkRunId = 0; for (let i = 0; i < annotations.length; i += 50) { const params = { @@ -105,7 +110,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< } } - logger.info('Posted all postable annotations (none if there are no violations).'); + logger.info('Posted all postable annotations'); } function createReviewCommentBody(annotation: ExtendedAnnotation): string { diff --git a/src/viewer/annotations.ts b/src/viewer/annotations.ts index 5a23ff5d..9234c815 100644 --- a/src/viewer/annotations.ts +++ b/src/viewer/annotations.ts @@ -1,4 +1,4 @@ -import { ticsConfig } from '../configuration/config'; +import { actionConfig, ticsConfig } from '../configuration/config'; import { ChangedFile } from '../github/interfaces'; import { logger } from '../helper/logger'; import { getRetryErrorMessage } from '../helper/response'; @@ -58,7 +58,10 @@ async function fetchAnnotationsWithApiLinks(apiLinks: AnnotationApiLink[]): Prom async function fetchAnnotationsByRun(identifier: TicsRunIdentifier): Promise { const annotationsUrl = new URL(`${ticsConfig.baseUrl}/api/public/v1/Annotations?metric=QualityGate()`); - let filters = `Project(${identifier.project}),AnnotationSeverity(Set(blocking,after))`; + let filters = `Project(${identifier.project})`; + if (!actionConfig.includeNonBlockingAnnotations) { + filters += ',AnnotationSeverity(Set(blocking,after))'; + } if (identifier.cdtoken) { filters += `,ClientData(${identifier.cdtoken})`; } else if (identifier.date) { From 20ff727101358de71209b6c64601b9fa755d8b14 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:28:34 +0100 Subject: [PATCH 13/22] #35162: Non-blocking annotations are notices now, blocking-after issues are filtered too --- dist/index.js | 28 +++++++++++++++++++++------- src/github/annotations.ts | 31 +++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/dist/index.js b/dist/index.js index e8bd5dce..4e01167a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1470,16 +1470,20 @@ async function postAnnotations(projectResults) { } const annotations = projectResults .flatMap(projectResult => projectResult.annotations) - .filter(annotation => annotation.postable) + .filter(shouldPostAnnotation) .map(annotation => { const title = annotation.msg; const body = createReviewCommentBody(annotation); - let level = 'warning'; - if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { - level = 'warning'; - } - else if (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) { - level = 'notice'; + let level; + switch (annotation.blocking?.state) { + case 'no': + case 'after': + level = 'notice'; + break; + case 'yes': + default: + level = 'warning'; + break; } return { title: title, @@ -1534,6 +1538,13 @@ async function postAnnotations(projectResults) { } logger_1.logger.info('Posted all postable annotations'); } +function shouldPostAnnotation(annotation) { + return (annotation.postable && + (annotation.blocking?.state === undefined || + annotation.blocking.state === 'yes' || + (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) || + (annotation.blocking.state === 'no' && config_1.actionConfig.includeNonBlockingAnnotations))); +} function createReviewCommentBody(annotation) { let body = ''; if (annotation.blocking?.state === 'yes') { @@ -1542,6 +1553,9 @@ function createReviewCommentBody(annotation) { else if (annotation.blocking?.state === 'after' && annotation.blocking.after) { body += `Blocking after: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}`; } + else { + body += `Non-Blocking`; + } const secondLine = []; if (annotation.level) { secondLine.push(`Level: ${annotation.level.toString()}`); diff --git a/src/github/annotations.ts b/src/github/annotations.ts index c46b3d1d..46c99831 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -47,16 +47,23 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< const annotations: GithubAnnotation[] = projectResults .flatMap(projectResult => projectResult.annotations) - .filter(annotation => annotation.postable) + .filter(shouldPostAnnotation) .map(annotation => { const title = annotation.msg; const body = createReviewCommentBody(annotation); - let level: AnnotationLevel = 'warning'; - if (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes') { - level = 'warning'; - } else if (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) { - level = 'notice'; + + let level: AnnotationLevel; + switch (annotation.blocking?.state) { + case 'no': + case 'after': + level = 'notice'; + break; + case 'yes': + default: + level = 'warning'; + break; } + return { title: title, message: body, @@ -113,12 +120,24 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< logger.info('Posted all postable annotations'); } +function shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { + return ( + annotation.postable && + (annotation.blocking?.state === undefined || + annotation.blocking.state === 'yes' || + (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) || + (annotation.blocking.state === 'no' && actionConfig.includeNonBlockingAnnotations)) + ); +} + function createReviewCommentBody(annotation: ExtendedAnnotation): string { let body = ''; if (annotation.blocking?.state === 'yes') { body += `Blocking`; } else if (annotation.blocking?.state === 'after' && annotation.blocking.after) { body += `Blocking after: ${format(annotation.blocking.after, 'yyyy-MM-dd')}`; + } else { + body += `Non-Blocking`; } const secondLine: string[] = []; From d14b62ad18b502e7007b135780adcd507777f59f Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:47:05 +0100 Subject: [PATCH 14/22] #35162: Removed `;` when setting TICS environment to hopefully fix it not being passed to TICS --- dist/index.js | 2 +- src/tics/analyzer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4e01167a..45cd0e2e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2606,7 +2606,7 @@ async function buildRunCommand(fileListPath) { } } else if ((0, os_1.platform)() === 'linux') { - installCommand = `TICS='${config_1.ticsConfig.viewerUrl}';`; + installCommand = `TICS='${config_1.ticsConfig.viewerUrl}'`; } else { installCommand = `$env:TICS='${config_1.ticsConfig.viewerUrl}'`; diff --git a/src/tics/analyzer.ts b/src/tics/analyzer.ts index 5cbdf9c3..5d5d5d9f 100644 --- a/src/tics/analyzer.ts +++ b/src/tics/analyzer.ts @@ -81,7 +81,7 @@ async function buildRunCommand(fileListPath: string): Promise { installCommand += ' &&'; } } else if (platform() === 'linux') { - installCommand = `TICS='${ticsConfig.viewerUrl}';`; + installCommand = `TICS='${ticsConfig.viewerUrl}'`; } else { installCommand = `$env:TICS='${ticsConfig.viewerUrl}'`; } From d819279fad3ab87bcd84940943f98de6f5aa3650 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:55:35 +0100 Subject: [PATCH 15/22] #35162: Fixed case where blocking after is not shown if date is not set --- dist/index.js | 21 ++++++++++++--------- src/github/annotations.ts | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 45cd0e2e..4917ca93 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1546,15 +1546,18 @@ function shouldPostAnnotation(annotation) { (annotation.blocking.state === 'no' && config_1.actionConfig.includeNonBlockingAnnotations))); } function createReviewCommentBody(annotation) { - let body = ''; - if (annotation.blocking?.state === 'yes') { - body += `Blocking`; - } - else if (annotation.blocking?.state === 'after' && annotation.blocking.after) { - body += `Blocking after: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}`; - } - else { - body += `Non-Blocking`; + let body; + switch (annotation.blocking?.state) { + case 'no': + body = 'Non-Blocking'; + break; + case 'after': + body = `Blocking after ${annotation.blocking.after ? `: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + break; + case 'yes': + default: + body = 'Blocking'; + break; } const secondLine = []; if (annotation.level) { diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 46c99831..8f4eff8c 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -131,13 +131,18 @@ function shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { } function createReviewCommentBody(annotation: ExtendedAnnotation): string { - let body = ''; - if (annotation.blocking?.state === 'yes') { - body += `Blocking`; - } else if (annotation.blocking?.state === 'after' && annotation.blocking.after) { - body += `Blocking after: ${format(annotation.blocking.after, 'yyyy-MM-dd')}`; - } else { - body += `Non-Blocking`; + let body: string; + switch (annotation.blocking?.state) { + case 'no': + body = 'Non-Blocking'; + break; + case 'after': + body = `Blocking after ${annotation.blocking.after ? `: ${format(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + break; + case 'yes': + default: + body = 'Blocking'; + break; } const secondLine: string[] = []; From 22bdd60b41cbaeb6c0b3620ad788faadeae3c3b4 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 3 Nov 2025 17:42:09 +0100 Subject: [PATCH 16/22] #35162: Fixed tests that were missing configuration or inputs --- dist/index.js | 4 +-- src/configuration/github.ts | 6 ++-- test/.setup/mock.ts | 6 ++-- test/integration/configuration.test.ts | 1 + test/integration/httpclient.test.ts | 1 + test/integration/octokit.test.ts | 1 + test/unit/configuration/github.test.ts | 2 +- test/unit/tics/analyzer.test.ts | 46 +++++++++++++------------- 8 files changed, 36 insertions(+), 31 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4917ca93..3e17c7fa 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1082,8 +1082,8 @@ class GithubConfig { // Should run after getGithubEvent if (this.event.isPullRequest) { const pr = github_1.context.payload.pull_request; - logger_1.logger.debug(`Found pull_request.head.sha: ${pr.head?.sha ?? 'undefined'}`); - return pr.head?.sha; + logger_1.logger.debug(`Found pull_request.head.sha: ${pr?.head?.sha ?? 'undefined'}`); + return pr?.head?.sha; } else { return github_1.context.sha; diff --git a/src/configuration/github.ts b/src/configuration/github.ts index 5adb4a28..d53f0e0c 100644 --- a/src/configuration/github.ts +++ b/src/configuration/github.ts @@ -86,9 +86,9 @@ export class GithubConfig { private getHeadSha(): string | undefined { // Should run after getGithubEvent if (this.event.isPullRequest) { - const pr = context.payload.pull_request as { head?: { sha?: string } }; - logger.debug(`Found pull_request.head.sha: ${pr.head?.sha ?? 'undefined'}`); - return pr.head?.sha; + const pr = context.payload.pull_request as { head?: { sha?: string } } | undefined; + logger.debug(`Found pull_request.head.sha: ${pr?.head?.sha ?? 'undefined'}`); + return pr?.head?.sha; } else { return context.sha; } diff --git a/test/.setup/mock.ts b/test/.setup/mock.ts index 4d8fedc6..ffae4a04 100644 --- a/test/.setup/mock.ts +++ b/test/.setup/mock.ts @@ -6,7 +6,8 @@ export const githubConfigMock: { apiUrl: string; owner: string; reponame: string; - commitSha: string; + sha: string; + headSha: string; event: GithubEvent; job: string; action: string; @@ -22,7 +23,8 @@ export const githubConfigMock: { apiUrl: 'github.com/api/v1/', owner: 'tester', reponame: 'test', - commitSha: 'sha-128', + sha: 'sha-128', + headSha: 'head-sha-256', event: GithubEvent.PUSH, job: 'TICS', action: 'tics-github-action', diff --git a/test/integration/configuration.test.ts b/test/integration/configuration.test.ts index ca3c3c82..45775acc 100644 --- a/test/integration/configuration.test.ts +++ b/test/integration/configuration.test.ts @@ -7,6 +7,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; +process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/integration/httpclient.test.ts b/test/integration/httpclient.test.ts index 35fdb42a..839acd76 100644 --- a/test/integration/httpclient.test.ts +++ b/test/integration/httpclient.test.ts @@ -20,6 +20,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; +process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/integration/octokit.test.ts b/test/integration/octokit.test.ts index 3ffe828f..9365e371 100644 --- a/test/integration/octokit.test.ts +++ b/test/integration/octokit.test.ts @@ -22,6 +22,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; +process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/unit/configuration/github.test.ts b/test/unit/configuration/github.test.ts index 60744837..509e3510 100644 --- a/test/unit/configuration/github.test.ts +++ b/test/unit/configuration/github.test.ts @@ -41,7 +41,7 @@ describe('gitHub Configuration', () => { apiUrl: 'api.github.com', owner: 'tiobe', reponame: 'tics-github-action', - commitSha: 'sha-128', + sha: 'sha-128', event: { name: 'pull_request', isPullRequest: true }, id: `123_1_TICS_tics-github-action`, pullRequestNumber: 1 diff --git a/test/unit/tics/analyzer.test.ts b/test/unit/tics/analyzer.test.ts index 41ea457b..d2fad398 100644 --- a/test/unit/tics/analyzer.test.ts +++ b/test/unit/tics/analyzer.test.ts @@ -42,7 +42,7 @@ describe('test multiple types of configuration', () => { expect(response.statusCode).toBe(0); expect(response.completed).toBe(true); - expect(spy).toHaveBeenCalledWith(`/bin/bash -c "TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default'; TICS -ide github -help"`, [], { + expect(spy).toHaveBeenCalledWith(`/bin/bash -c "TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default' TICS -ide github -help"`, [], { listeners: { errline: expect.any(Function), stdline: expect.any(Function) }, silent: true }); @@ -60,7 +60,7 @@ describe('test multiple types of configuration', () => { expect(response.statusCode).toBe(0); expect(response.completed).toBe(true); expect(spy).toHaveBeenCalledWith( - `/bin/bash -c "TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default'; TICS -ide github '@/path/to' -viewer -project 'project' -calc GATE"`, + `/bin/bash -c "TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default' TICS -ide github '@/path/to' -viewer -project 'project' -calc GATE"`, [], { listeners: { errline: expect.any(Function), stdline: expect.any(Function) }, @@ -103,7 +103,7 @@ describe('test multiple types of configuration', () => { expect(response.statusCode).toBe(0); expect(response.completed).toBe(true); expect(spy).toHaveBeenCalledWith( - "/bin/bash -c \"TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default'; TICS -ide github '@/path/to' -viewer -project 'project' -cdtoken token -calc CS -tmpdir '/home/ubuntu/test/123_TICS_1_tics-github-action' -log 9\"", + "/bin/bash -c \"TICS='http://base.com/tiobeweb/TICS/api/cfg?name=default' TICS -ide github '@/path/to' -viewer -project 'project' -cdtoken token -calc CS -tmpdir '/home/ubuntu/test/123_TICS_1_tics-github-action' -log 9\"", [], { listeners: { errline: expect.any(Function), stdline: expect.any(Function) }, @@ -371,8 +371,8 @@ describe('test callback functions', () => { it('should return single error if already exists in errorlist', async () => { await jest.isolateModulesAsync(async () => { - const analyzer = require("../../../src/tics/analyzer"); - const exec = require("@actions/exec"); + const analyzer = require('../../../src/tics/analyzer'); + const exec = require('@actions/exec'); (exec.exec as any).mockResolvedValue(0); ticsConfigMock.installTics = false; @@ -387,8 +387,8 @@ describe('test callback functions', () => { it('should return two errors in errorlist', async () => { await jest.isolateModulesAsync(async () => { - const analyzer = require("../../../src/tics/analyzer"); - const exec = require("@actions/exec"); + const analyzer = require('../../../src/tics/analyzer'); + const exec = require('@actions/exec'); (exec.exec as any).mockResolvedValue(0); const response = await analyzer.runTicsAnalyzer('/path/to'); @@ -402,16 +402,16 @@ describe('test callback functions', () => { it('should return warnings in warningList', async () => { await jest.isolateModulesAsync(async () => { - const analyzer = require("../../../src/tics/analyzer"); - const exec = require("@actions/exec"); + const analyzer = require('../../../src/tics/analyzer'); + const exec = require('@actions/exec'); (exec.exec as any).mockResolvedValue(0); - + const response = await analyzer.runTicsAnalyzer('/path/to'); (exec.exec as any).mock.calls[0][2].listeners.stdline('[WARNING 5057] Warning'); (exec.exec as any).mock.calls[0][2].listeners.stdline(`No files to analyze with option '-changed': all checkable files seem to be unchanged.`); (exec.exec as any).mock.calls[0][2].listeners.stdline('[WARNING 666] Warning'); (exec.exec as any).mock.calls[0][2].listeners.stdline('[WARNING 777] Warning'); - + expect(response.warningList).toHaveLength(4); expect(response.warningList).toEqual([ '[WARNING 5057] Warning', @@ -424,8 +424,8 @@ describe('test callback functions', () => { it('should add ExplorerUrl in response', async () => { await jest.isolateModulesAsync(async () => { - const analyzer = require("../../../src/tics/analyzer"); - const exec = require("@actions/exec"); + const analyzer = require('../../../src/tics/analyzer'); + const exec = require('@actions/exec'); (exec.exec as any).mockResolvedValue(0); ticsConfigMock.displayUrl = 'http://viewer.com'; @@ -439,22 +439,22 @@ describe('test callback functions', () => { it('should add all ExplorerUrls in response', async () => { await jest.isolateModulesAsync(async () => { - const analyzer = require("../../../src/tics/analyzer"); - const exec = require("@actions/exec"); + const analyzer = require('../../../src/tics/analyzer'); + const exec = require('@actions/exec'); (exec.exec as any).mockResolvedValue(0); ticsConfigMock.displayUrl = 'http://viewer.com'; - + await analyzer.runTicsAnalyzer('/another/path'); - (exec.exec as any).mock.calls[0][2].listeners.stdline("http://base.com/Explorer.html#axes=ClientData0"); - (exec.exec as any).mock.calls[0][2].listeners.stdline("http://base.com/Explorer.html#axes=ClientData1"); - (exec.exec as any).mock.calls[0][2].listeners.stdline("http://base.com/Explorer.html#axes=ClientData2"); - + (exec.exec as any).mock.calls[0][2].listeners.stdline('http://base.com/Explorer.html#axes=ClientData0'); + (exec.exec as any).mock.calls[0][2].listeners.stdline('http://base.com/Explorer.html#axes=ClientData1'); + (exec.exec as any).mock.calls[0][2].listeners.stdline('http://base.com/Explorer.html#axes=ClientData2'); + const response = await analyzer.runTicsAnalyzer('/another/path'); expect(response.explorerUrls).toEqual([ - "http://viewer.com/Explorer.html#axes=ClientData0", - "http://viewer.com/Explorer.html#axes=ClientData1", - "http://viewer.com/Explorer.html#axes=ClientData2", + 'http://viewer.com/Explorer.html#axes=ClientData0', + 'http://viewer.com/Explorer.html#axes=ClientData1', + 'http://viewer.com/Explorer.html#axes=ClientData2' ]); }); }); From b0bd6a76751f3ec178a3c580226aa4d6cf141127 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:33:57 +0100 Subject: [PATCH 17/22] #35162: Extended tests for posting annotations --- dist/index.js | 3039 ++------------------- dist/licenses.txt | 25 - package-lock.json | 12 + package.json | 2 +- src/github/annotations.ts | 56 +- test/.setup/mock.ts | 5 + test/unit/action/decorate/summary.test.ts | 1 - test/unit/github/annotations.test.ts | 322 ++- test/unit/github/objects/annotations.ts | 99 +- 9 files changed, 640 insertions(+), 2921 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3e17c7fa..aaa2c1b6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1471,29 +1471,7 @@ async function postAnnotations(projectResults) { const annotations = projectResults .flatMap(projectResult => projectResult.annotations) .filter(shouldPostAnnotation) - .map(annotation => { - const title = annotation.msg; - const body = createReviewCommentBody(annotation); - let level; - switch (annotation.blocking?.state) { - case 'no': - case 'after': - level = 'notice'; - break; - case 'yes': - default: - level = 'warning'; - break; - } - return { - title: title, - message: body, - annotation_level: level, - path: annotation.path, - start_line: annotation.line, - end_line: annotation.line - }; - }); + .map(createGithubAnnotation); if (annotations.length === 0) { logger_1.logger.info('No annotations to post.'); return; @@ -1545,6 +1523,29 @@ function shouldPostAnnotation(annotation) { (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) || (annotation.blocking.state === 'no' && config_1.actionConfig.includeNonBlockingAnnotations))); } +function createGithubAnnotation(annotation) { + const title = annotation.msg; + const body = createReviewCommentBody(annotation); + let level; + switch (annotation.blocking?.state) { + case 'no': + case 'after': + level = 'notice'; + break; + case 'yes': + default: + level = 'warning'; + break; + } + return { + title: title, + message: body, + annotation_level: level, + path: annotation.path, + start_line: annotation.line, + end_line: annotation.line + }; +} function createReviewCommentBody(annotation) { let body; switch (annotation.blocking?.state) { @@ -1552,7 +1553,7 @@ function createReviewCommentBody(annotation) { body = 'Non-Blocking'; break; case 'after': - body = `Blocking after ${annotation.blocking.after ? `: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + body = `Blocking after${annotation.blocking.after ? `: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: @@ -5195,12 +5196,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.deleteArtifactInternal = exports.deleteArtifactPublic = void 0; +exports.deleteArtifactPublic = deleteArtifactPublic; +exports.deleteArtifactInternal = deleteArtifactInternal; const core_1 = __nccwpck_require__(37484); -const github_1 = __nccwpck_require__(29150); +const github_1 = __nccwpck_require__(93228); const user_agent_1 = __nccwpck_require__(89387); const retry_options_1 = __nccwpck_require__(38361); -const utils_1 = __nccwpck_require__(97864); +const utils_1 = __nccwpck_require__(38006); const plugin_request_log_1 = __nccwpck_require__(6966); const plugin_retry_1 = __nccwpck_require__(47164); const artifact_twirp_client_1 = __nccwpck_require__(87417); @@ -5209,8 +5211,8 @@ const generated_1 = __nccwpck_require__(44216); const get_artifact_1 = __nccwpck_require__(2327); const errors_1 = __nccwpck_require__(45655); function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { - var _a; return __awaiter(this, void 0, void 0, function* () { + var _a; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); const opts = { log: undefined, @@ -5234,7 +5236,6 @@ function deleteArtifactPublic(artifactName, workflowRunId, repositoryOwner, repo }; }); } -exports.deleteArtifactPublic = deleteArtifactPublic; function deleteArtifactInternal(artifactName) { return __awaiter(this, void 0, void 0, function* () { const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); @@ -5265,7 +5266,6 @@ function deleteArtifactInternal(artifactName) { }; }); } -exports.deleteArtifactInternal = deleteArtifactInternal; //# sourceMappingURL=delete-artifact.js.map /***/ }), @@ -5291,13 +5291,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __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) { @@ -5311,11 +5321,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.downloadArtifactInternal = exports.downloadArtifactPublic = exports.streamExtractExternal = void 0; +exports.streamExtractExternal = streamExtractExternal; +exports.downloadArtifactPublic = downloadArtifactPublic; +exports.downloadArtifactInternal = downloadArtifactInternal; const promises_1 = __importDefault(__nccwpck_require__(91943)); const crypto = __importStar(__nccwpck_require__(76982)); const stream = __importStar(__nccwpck_require__(2203)); -const github = __importStar(__nccwpck_require__(29150)); +const github = __importStar(__nccwpck_require__(93228)); const core = __importStar(__nccwpck_require__(37484)); const httpClient = __importStar(__nccwpck_require__(54844)); const unzip_stream_1 = __importDefault(__nccwpck_require__(33991)); @@ -5363,20 +5375,21 @@ function streamExtract(url, directory) { throw new Error(`Artifact download failed after ${retryCount} retries.`); }); } -function streamExtractExternal(url, directory) { - return __awaiter(this, void 0, void 0, function* () { +function streamExtractExternal(url_1, directory_1) { + return __awaiter(this, arguments, void 0, function* (url, directory, opts = { timeout: 30 * 1000 }) { const client = new httpClient.HttpClient((0, user_agent_1.getUserAgentString)()); const response = yield client.get(url); if (response.message.statusCode !== 200) { throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); } - const timeout = 30 * 1000; // 30 seconds let sha256Digest = undefined; return new Promise((resolve, reject) => { const timerFn = () => { - response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`)); + const timeoutError = new Error(`Blob storage chunk did not respond in ${opts.timeout}ms`); + response.message.destroy(timeoutError); + reject(timeoutError); }; - const timer = setTimeout(timerFn, timeout); + const timer = setTimeout(timerFn, opts.timeout); const hashStream = crypto.createHash('sha256').setEncoding('hex'); const passThrough = new stream.PassThrough(); response.message.pipe(passThrough); @@ -5407,7 +5420,6 @@ function streamExtractExternal(url, directory) { }); }); } -exports.streamExtractExternal = streamExtractExternal; function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, token, options) { return __awaiter(this, void 0, void 0, function* () { const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path); @@ -5449,7 +5461,6 @@ function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, tok return { downloadPath, digestMismatch }; }); } -exports.downloadArtifactPublic = downloadArtifactPublic; function downloadArtifactInternal(artifactId, options) { return __awaiter(this, void 0, void 0, function* () { const downloadPath = yield resolveOrCreateDirectory(options === null || options === void 0 ? void 0 : options.path); @@ -5493,9 +5504,8 @@ function downloadArtifactInternal(artifactId, options) { return { downloadPath, digestMismatch }; }); } -exports.downloadArtifactInternal = downloadArtifactInternal; -function resolveOrCreateDirectory(downloadPath = (0, config_1.getGitHubWorkspaceDir)()) { - return __awaiter(this, void 0, void 0, function* () { +function resolveOrCreateDirectory() { + return __awaiter(this, arguments, void 0, function* (downloadPath = (0, config_1.getGitHubWorkspaceDir)()) { if (!(yield exists(downloadPath))) { core.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`); yield promises_1.default.mkdir(downloadPath, { recursive: true }); @@ -5531,13 +5541,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __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) { @@ -5548,11 +5568,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getArtifactInternal = exports.getArtifactPublic = void 0; -const github_1 = __nccwpck_require__(29150); +exports.getArtifactPublic = getArtifactPublic; +exports.getArtifactInternal = getArtifactInternal; +const github_1 = __nccwpck_require__(93228); const plugin_retry_1 = __nccwpck_require__(47164); const core = __importStar(__nccwpck_require__(37484)); -const utils_1 = __nccwpck_require__(97864); +const utils_1 = __nccwpck_require__(38006); const retry_options_1 = __nccwpck_require__(38361); const plugin_request_log_1 = __nccwpck_require__(6966); const util_1 = __nccwpck_require__(64012); @@ -5561,8 +5582,8 @@ const artifact_twirp_client_1 = __nccwpck_require__(87417); const generated_1 = __nccwpck_require__(44216); const errors_1 = __nccwpck_require__(45655); function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) { - var _a; return __awaiter(this, void 0, void 0, function* () { + var _a; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); const opts = { log: undefined, @@ -5604,10 +5625,9 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit }; }); } -exports.getArtifactPublic = getArtifactPublic; function getArtifactInternal(artifactName) { - var _a; return __awaiter(this, void 0, void 0, function* () { + var _a; const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); const { workflowRunBackendId, workflowJobRunBackendId } = (0, util_1.getBackendIdsFromToken)(); const req = { @@ -5639,7 +5659,6 @@ function getArtifactInternal(artifactName) { }; }); } -exports.getArtifactInternal = getArtifactInternal; //# sourceMappingURL=get-artifact.js.map /***/ }), @@ -5659,23 +5678,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.listArtifactsInternal = exports.listArtifactsPublic = void 0; +exports.listArtifactsPublic = listArtifactsPublic; +exports.listArtifactsInternal = listArtifactsInternal; const core_1 = __nccwpck_require__(37484); -const github_1 = __nccwpck_require__(29150); +const github_1 = __nccwpck_require__(93228); const user_agent_1 = __nccwpck_require__(89387); const retry_options_1 = __nccwpck_require__(38361); -const utils_1 = __nccwpck_require__(97864); +const utils_1 = __nccwpck_require__(38006); const plugin_request_log_1 = __nccwpck_require__(6966); const plugin_retry_1 = __nccwpck_require__(47164); const artifact_twirp_client_1 = __nccwpck_require__(87417); const util_1 = __nccwpck_require__(64012); +const config_1 = __nccwpck_require__(72938); const generated_1 = __nccwpck_require__(44216); -// Limiting to 1000 for perf reasons -const maximumArtifactCount = 1000; +const maximumArtifactCount = (0, config_1.getMaxArtifactListCount)(); const paginationCount = 100; -const maxNumberOfPages = maximumArtifactCount / paginationCount; -function listArtifactsPublic(workflowRunId, repositoryOwner, repositoryName, token, latest = false) { - return __awaiter(this, void 0, void 0, function* () { +const maxNumberOfPages = Math.ceil(maximumArtifactCount / paginationCount); +function listArtifactsPublic(workflowRunId_1, repositoryOwner_1, repositoryName_1, token_1) { + return __awaiter(this, arguments, void 0, function* (workflowRunId, repositoryOwner, repositoryName, token, latest = false) { (0, core_1.info)(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`); let artifacts = []; const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults); @@ -5698,7 +5718,7 @@ function listArtifactsPublic(workflowRunId, repositoryOwner, repositoryName, tok let numberOfPages = Math.ceil(listArtifactResponse.total_count / paginationCount); const totalArtifactCount = listArtifactResponse.total_count; if (totalArtifactCount > maximumArtifactCount) { - (0, core_1.warning)(`Workflow run ${workflowRunId} has more than 1000 artifacts. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`); + (0, core_1.warning)(`Workflow run ${workflowRunId} has ${totalArtifactCount} artifacts, exceeding the limit of ${maximumArtifactCount}. Results will be incomplete as only the first ${maximumArtifactCount} artifacts will be returned`); numberOfPages = maxNumberOfPages; } // Iterate over the first page @@ -5716,7 +5736,7 @@ function listArtifactsPublic(workflowRunId, repositoryOwner, repositoryName, tok // Move to the next page currentPageNumber++; // Iterate over any remaining pages - for (currentPageNumber; currentPageNumber < numberOfPages; currentPageNumber++) { + for (currentPageNumber; currentPageNumber <= numberOfPages; currentPageNumber++) { (0, core_1.debug)(`Fetching page ${currentPageNumber} of artifact list`); const { data: listArtifactResponse } = yield github.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts', { owner: repositoryOwner, @@ -5746,9 +5766,8 @@ function listArtifactsPublic(workflowRunId, repositoryOwner, repositoryName, tok }; }); } -exports.listArtifactsPublic = listArtifactsPublic; -function listArtifactsInternal(latest = false) { - return __awaiter(this, void 0, void 0, function* () { +function listArtifactsInternal() { + return __awaiter(this, arguments, void 0, function* (latest = false) { const artifactClient = (0, artifact_twirp_client_1.internalArtifactTwirpClient)(); const { workflowRunBackendId, workflowJobRunBackendId } = (0, util_1.getBackendIdsFromToken)(); const req = { @@ -5777,7 +5796,6 @@ function listArtifactsInternal(latest = false) { }; }); } -exports.listArtifactsInternal = listArtifactsInternal; /** * Filters a list of artifacts to only include the latest artifact for each name * @param artifacts The artifacts to filter @@ -5820,15 +5838,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getRetryOptions = void 0; +exports.getRetryOptions = getRetryOptions; const core = __importStar(__nccwpck_require__(37484)); // Defaults for fetching artifacts const defaultMaxRetryNumber = 5; @@ -5851,7 +5879,6 @@ function getRetryOptions(defaultOptions, retries = defaultMaxRetryNumber, exempt core.debug(`GitHub client configured with: (retries: ${requestOptions.retries}, retry-exempt-status-code: ${(_a = retryOptions.doNotRetry) !== null && _a !== void 0 ? _a : 'octokit default: [400, 401, 403, 404, 422]'})`); return [retryOptions, requestOptions]; } -exports.getRetryOptions = getRetryOptions; //# sourceMappingURL=retry-options.js.map /***/ }), @@ -5871,7 +5898,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.internalArtifactTwirpClient = void 0; +exports.internalArtifactTwirpClient = internalArtifactTwirpClient; const http_client_1 = __nccwpck_require__(54844); const auth_1 = __nccwpck_require__(44552); const core_1 = __nccwpck_require__(37484); @@ -6012,7 +6039,6 @@ function internalArtifactTwirpClient(options) { const client = new ArtifactHttpClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier); return new generated_1.ArtifactServiceClientJSON(client); } -exports.internalArtifactTwirpClient = internalArtifactTwirpClient; //# sourceMappingURL=artifact-twirp-client.js.map /***/ }), @@ -6026,7 +6052,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUploadChunkTimeout = exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; +exports.getUploadChunkSize = getUploadChunkSize; +exports.getRuntimeToken = getRuntimeToken; +exports.getResultsServiceUrl = getResultsServiceUrl; +exports.isGhes = isGhes; +exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; +exports.getConcurrency = getConcurrency; +exports.getUploadChunkTimeout = getUploadChunkTimeout; +exports.getMaxArtifactListCount = getMaxArtifactListCount; const os_1 = __importDefault(__nccwpck_require__(70857)); const core_1 = __nccwpck_require__(37484); // Used for controlling the highWaterMark value of the zip that is being streamed @@ -6034,7 +6067,6 @@ const core_1 = __nccwpck_require__(37484); function getUploadChunkSize() { return 8 * 1024 * 1024; // 8 MB Chunks } -exports.getUploadChunkSize = getUploadChunkSize; function getRuntimeToken() { const token = process.env['ACTIONS_RUNTIME_TOKEN']; if (!token) { @@ -6042,7 +6074,6 @@ function getRuntimeToken() { } return token; } -exports.getRuntimeToken = getRuntimeToken; function getResultsServiceUrl() { const resultsUrl = process.env['ACTIONS_RESULTS_URL']; if (!resultsUrl) { @@ -6050,7 +6081,6 @@ function getResultsServiceUrl() { } return new URL(resultsUrl).origin; } -exports.getResultsServiceUrl = getResultsServiceUrl; function isGhes() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const hostname = ghUrl.hostname.trimEnd().toUpperCase(); @@ -6059,7 +6089,6 @@ function isGhes() { const isLocalHost = hostname.endsWith('.LOCALHOST'); return !isGitHubHost && !isGheHost && !isLocalHost; } -exports.isGhes = isGhes; function getGitHubWorkspaceDir() { const ghWorkspaceDir = process.env['GITHUB_WORKSPACE']; if (!ghWorkspaceDir) { @@ -6067,7 +6096,6 @@ function getGitHubWorkspaceDir() { } return ghWorkspaceDir; } -exports.getGitHubWorkspaceDir = getGitHubWorkspaceDir; // The maximum value of concurrency is 300. // This value can be changed with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable. function getConcurrency() { @@ -6093,7 +6121,6 @@ function getConcurrency() { // default concurrency to 5 return 5; } -exports.getConcurrency = getConcurrency; function getUploadChunkTimeout() { const timeoutVar = process.env['ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS']; if (!timeoutVar) { @@ -6105,7 +6132,16 @@ function getUploadChunkTimeout() { } return timeout; } -exports.getUploadChunkTimeout = getUploadChunkTimeout; +// This value can be changed with ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT variable. +// Defaults to 1000 as a safeguard for rate limiting. +function getMaxArtifactListCount() { + const maxCountVar = process.env['ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT'] || '1000'; + const maxCount = parseInt(maxCountVar); + if (isNaN(maxCount) || maxCount < 1) { + throw new Error('Invalid value set for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT env variable'); + } + return maxCount; +} //# sourceMappingURL=config.js.map /***/ }), @@ -6203,7 +6239,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUserAgentString = void 0; +exports.getUserAgentString = getUserAgentString; // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports const packageJson = __nccwpck_require__(2822); /** @@ -6212,7 +6248,6 @@ const packageJson = __nccwpck_require__(2822); function getUserAgentString() { return `@actions/artifact-${packageJson.version}`; } -exports.getUserAgentString = getUserAgentString; //# sourceMappingURL=user-agent.js.map /***/ }), @@ -6238,18 +6273,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.maskSecretUrls = exports.maskSigUrl = exports.getBackendIdsFromToken = void 0; +exports.getBackendIdsFromToken = getBackendIdsFromToken; +exports.maskSigUrl = maskSigUrl; +exports.maskSecretUrls = maskSecretUrls; const core = __importStar(__nccwpck_require__(37484)); const config_1 = __nccwpck_require__(72938); const jwt_decode_1 = __importDefault(__nccwpck_require__(79699)); @@ -6301,7 +6348,6 @@ function getBackendIdsFromToken() { } throw InvalidJwtError; } -exports.getBackendIdsFromToken = getBackendIdsFromToken; /** * Masks the `sig` parameter in a URL and sets it as a secret. * @@ -6334,7 +6380,6 @@ function maskSigUrl(url) { (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); } } -exports.maskSigUrl = maskSigUrl; /** * Masks sensitive information in URLs containing signature parameters. * Currently supports masking 'sig' parameters in the 'signed_upload_url' @@ -6369,7 +6414,6 @@ function maskSecretUrls(body) { maskSigUrl(body.signed_url); } } -exports.maskSecretUrls = maskSecretUrls; //# sourceMappingURL=util.js.map /***/ }), @@ -6395,13 +6439,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __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) { @@ -6412,7 +6466,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uploadZipToBlobStorage = void 0; +exports.uploadZipToBlobStorage = uploadZipToBlobStorage; const storage_blob_1 = __nccwpck_require__(1012); const config_1 = __nccwpck_require__(72938); const core = __importStar(__nccwpck_require__(37484)); @@ -6486,7 +6540,6 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { }; }); } -exports.uploadZipToBlobStorage = uploadZipToBlobStorage; //# sourceMappingURL=blob-upload.js.map /***/ }), @@ -6497,7 +6550,8 @@ exports.uploadZipToBlobStorage = uploadZipToBlobStorage; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.validateFilePath = exports.validateArtifactName = void 0; +exports.validateArtifactName = validateArtifactName; +exports.validateFilePath = validateFilePath; const core_1 = __nccwpck_require__(37484); /** * Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected @@ -6541,7 +6595,6 @@ These characters are not allowed in the artifact name due to limitations with ce } (0, core_1.info)(`Artifact name is valid!`); } -exports.validateArtifactName = validateArtifactName; /** * Validates file paths to check for any illegal characters that can cause problems on different file systems */ @@ -6560,7 +6613,6 @@ The following characters are not allowed in files that are uploaded due to limit } } } -exports.validateFilePath = validateFilePath; //# sourceMappingURL=path-and-artifact-name-validation.js.map /***/ }), @@ -6586,15 +6638,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getExpiration = void 0; +exports.getExpiration = getExpiration; const generated_1 = __nccwpck_require__(44216); const core = __importStar(__nccwpck_require__(37484)); function getExpiration(retentionDays) { @@ -6610,7 +6672,6 @@ function getExpiration(retentionDays) { expirationDate.setDate(expirationDate.getDate() + retentionDays); return generated_1.Timestamp.fromDate(expirationDate); } -exports.getExpiration = getExpiration; function getRetentionDays() { const retentionDays = process.env['GITHUB_RETENTION_DAYS']; if (!retentionDays) { @@ -6647,13 +6708,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __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) { @@ -6664,7 +6735,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uploadArtifact = void 0; +exports.uploadArtifact = uploadArtifact; const core = __importStar(__nccwpck_require__(37484)); const retention_1 = __nccwpck_require__(47252); const path_and_artifact_name_validation_1 = __nccwpck_require__(89190); @@ -6732,7 +6803,6 @@ function uploadArtifact(name, files, rootDirectory, options) { }; }); } -exports.uploadArtifact = uploadArtifact; //# sourceMappingURL=upload-artifact.js.map /***/ }), @@ -6758,15 +6828,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUploadZipSpecification = exports.validateRootDirectory = void 0; +exports.validateRootDirectory = validateRootDirectory; +exports.getUploadZipSpecification = getUploadZipSpecification; const fs = __importStar(__nccwpck_require__(79896)); const core_1 = __nccwpck_require__(37484); const path_1 = __nccwpck_require__(16928); @@ -6784,7 +6865,6 @@ function validateRootDirectory(rootDirectory) { } (0, core_1.info)(`Root directory input is valid!`); } -exports.validateRootDirectory = validateRootDirectory; /** * Creates a specification that describes how a zip file will be created for a set of input files * @param filesToZip a list of file that should be included in the zip @@ -6855,7 +6935,6 @@ function getUploadZipSpecification(filesToZip, rootDirectory) { } return specification; } -exports.getUploadZipSpecification = getUploadZipSpecification; //# sourceMappingURL=upload-zip-specification.js.map /***/ }), @@ -6881,13 +6960,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( }) : 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 __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); var __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) { @@ -6898,7 +6987,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRESSION_LEVEL = void 0; +exports.ZipUploadStream = exports.DEFAULT_COMPRESSION_LEVEL = void 0; +exports.createZipUploadStream = createZipUploadStream; const stream = __importStar(__nccwpck_require__(2203)); const promises_1 = __nccwpck_require__(91943); const archiver = __importStar(__nccwpck_require__(99392)); @@ -6919,8 +7009,8 @@ class ZipUploadStream extends stream.Transform { } } exports.ZipUploadStream = ZipUploadStream; -function createZipUploadStream(uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) { - return __awaiter(this, void 0, void 0, function* () { +function createZipUploadStream(uploadSpecification_1) { + return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) { core.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`); const zip = archiver.create('zip', { highWaterMark: (0, config_1.getUploadChunkSize)(), @@ -6957,7 +7047,6 @@ function createZipUploadStream(uploadSpecification, compressionLevel = exports.D return zipUploadStream; }); } -exports.createZipUploadStream = createZipUploadStream; // eslint-disable-next-line @typescript-eslint/no-explicit-any const zipErrorCallback = (error) => { core.error('An error has occurred while creating the zip file for upload'); @@ -6983,2321 +7072,6 @@ const zipEndCallback = () => { }; //# sourceMappingURL=zip.js.map -/***/ }), - -/***/ 27466: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Context = void 0; -const fs_1 = __nccwpck_require__(79896); -const os_1 = __nccwpck_require__(70857); -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 - -/***/ }), - -/***/ 29150: -/***/ (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__(27466)); -const utils_1 = __nccwpck_require__(97864); -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 - -/***/ }), - -/***/ 14970: -/***/ (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__(54844)); -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 - -/***/ }), - -/***/ 97864: -/***/ (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__(27466)); -const Utils = __importStar(__nccwpck_require__(14970)); -// octokit + plugins -const core_1 = __nccwpck_require__(62647); -const plugin_rest_endpoint_methods_1 = __nccwpck_require__(47477); -const plugin_paginate_rest_1 = __nccwpck_require__(85060); -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 - -/***/ }), - -/***/ 62646: -/***/ ((__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 - - -/***/ }), - -/***/ 62647: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var universalUserAgent = __nccwpck_require__(33843); -var beforeAfterHook = __nccwpck_require__(52732); -var request = __nccwpck_require__(4085); -var graphql = __nccwpck_require__(43165); -var authToken = __nccwpck_require__(62646); - -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 - - -/***/ }), - -/***/ 28421: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var isPlainObject = __nccwpck_require__(93407); -var universalUserAgent = __nccwpck_require__(33843); - -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 - - -/***/ }), - -/***/ 43165: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var request = __nccwpck_require__(4085); -var universalUserAgent = __nccwpck_require__(33843); - -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 - - -/***/ }), - -/***/ 85060: -/***/ ((__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 - - -/***/ }), - -/***/ 47477: -/***/ ((__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 - - /***/ }), /***/ 47164: @@ -9382,273 +7156,6 @@ exports.retry = retry; //# sourceMappingURL=index.js.map -/***/ }), - -/***/ 4085: -/***/ ((__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__(28421); -var universalUserAgent = __nccwpck_require__(33843); -var isPlainObject = __nccwpck_require__(93407); -var nodeFetch = _interopDefault(__nccwpck_require__(26705)); -var requestError = __nccwpck_require__(67477); - -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 - }); - } - - 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; - } - - 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 - - -/***/ }), - -/***/ 67477: -/***/ ((__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__(14150); -var once = _interopDefault(__nccwpck_require__(55560)); - -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 - - /***/ }), /***/ 44914: @@ -89077,52 +86584,6 @@ exports.possibleElisions = possibleElisions; }(); // eslint-disable-line -/***/ }), - -/***/ 93407: -/***/ ((__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; - - /***/ }), /***/ 96543: @@ -207189,7 +204650,7 @@ function yearsToQuarters(years) { /***/ ((module) => { "use strict"; -module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/artifact","version":"2.3.2","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}'); +module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/artifact","version":"4.0.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^6.0.1","@actions/http-client":"^2.1.0","@azure/core-http":"^3.0.5","@azure/storage-blob":"^12.15.0","@octokit/core":"^5.2.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request":"^8.4.1","@octokit/request-error":"^5.1.1","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","jwt-decode":"^3.1.2","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.28.13","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}'); /***/ }), diff --git a/dist/licenses.txt b/dist/licenses.txt index 3b403ed8..c1966ceb 100644 --- a/dist/licenses.txt +++ b/dist/licenses.txt @@ -2490,31 +2490,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -is-plain-object -MIT -The MIT License (MIT) - -Copyright (c) 2014-2017, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - is-stream MIT MIT License diff --git a/package-lock.json b/package-lock.json index ccd788a8..6abab576 100644 --- a/package-lock.json +++ b/package-lock.json @@ -396,6 +396,7 @@ "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", @@ -2901,6 +2902,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz", "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==", + "peer": true, "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", @@ -3633,6 +3635,7 @@ "integrity": "sha512-Aq2dPqsQkxHOLfb2OPv43RnIvfj05nw8v/6n3B2NABIPpHnjQnaLo9QGMTvml+tv4korl/Cjfrb/BYhoL8UUTQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.42.0", @@ -3672,6 +3675,7 @@ "integrity": "sha512-r1XG74QgShUgXph1BYseJ+KZd17bKQib/yF3SR+demvytiRXrwd12Blnz5eYGm8tXaeRdd4x88MlfwldHoudGg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.42.0", "@typescript-eslint/types": "8.42.0", @@ -4224,6 +4228,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -5002,6 +5007,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001737", "electron-to-chromium": "^1.5.211", @@ -5586,6 +5592,7 @@ "integrity": "sha512-QePbBFMJFjgmlE+cXAlbHZbHpdFVS2E/6vzCy7aKlebddvl1vadiC4JFV5u/wqTkNUwEV8WrQi257jf5f06hrg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -5647,6 +5654,7 @@ "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -6324,6 +6332,7 @@ "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.11.0.tgz", "integrity": "sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw==", "dev": true, + "peer": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -6753,6 +6762,7 @@ "integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/core": "30.2.0", "@jest/types": "30.2.0", @@ -10866,6 +10876,7 @@ "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -11638,6 +11649,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index b80735cb..5f1b717a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "eslint .", "package": "npm run build && ncc build --license licenses.txt", "test": "jest", - "test:coverage": "jest --coverage --collectCoverageFrom='src/**'" + "test:coverage": "jest --coverage --collectCoverageFrom=\"src/**\"" }, "repository": { "type": "git", diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 8f4eff8c..5fea575d 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -45,34 +45,10 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< return; } - const annotations: GithubAnnotation[] = projectResults + const annotations = projectResults .flatMap(projectResult => projectResult.annotations) .filter(shouldPostAnnotation) - .map(annotation => { - const title = annotation.msg; - const body = createReviewCommentBody(annotation); - - let level: AnnotationLevel; - switch (annotation.blocking?.state) { - case 'no': - case 'after': - level = 'notice'; - break; - case 'yes': - default: - level = 'warning'; - break; - } - - return { - title: title, - message: body, - annotation_level: level, - path: annotation.path, - start_line: annotation.line, - end_line: annotation.line - }; - }); + .map(createGithubAnnotation); if (annotations.length === 0) { logger.info('No annotations to post.'); @@ -130,6 +106,32 @@ function shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { ); } +function createGithubAnnotation(annotation: ExtendedAnnotation): GithubAnnotation { + const title = annotation.msg; + const body = createReviewCommentBody(annotation); + + let level: AnnotationLevel; + switch (annotation.blocking?.state) { + case 'no': + case 'after': + level = 'notice'; + break; + case 'yes': + default: + level = 'warning'; + break; + } + + return { + title: title, + message: body, + annotation_level: level, + path: annotation.path, + start_line: annotation.line, + end_line: annotation.line + }; +} + function createReviewCommentBody(annotation: ExtendedAnnotation): string { let body: string; switch (annotation.blocking?.state) { @@ -137,7 +139,7 @@ function createReviewCommentBody(annotation: ExtendedAnnotation): string { body = 'Non-Blocking'; break; case 'after': - body = `Blocking after ${annotation.blocking.after ? `: ${format(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + body = `Blocking after${annotation.blocking.after ? `: ${format(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: diff --git a/test/.setup/mock.ts b/test/.setup/mock.ts index ffae4a04..75e1a85b 100644 --- a/test/.setup/mock.ts +++ b/test/.setup/mock.ts @@ -62,6 +62,7 @@ export const actionConfigMock = { secretsFilter: ['random'], excludeMovedFiles: false, postAnnotations: false, + includeNonBlockingAnnotations: false, postToConversation: false, pullRequestApproval: false, showBlockingAfter: false @@ -122,6 +123,10 @@ jest.mock('../../src/github/octokit', () => { }, rateLimit: { get: jest.fn() + }, + checks: { + create: jest.fn(), + update: jest.fn() } }, graphql: { diff --git a/test/unit/action/decorate/summary.test.ts b/test/unit/action/decorate/summary.test.ts index af71d487..26b75d1c 100644 --- a/test/unit/action/decorate/summary.test.ts +++ b/test/unit/action/decorate/summary.test.ts @@ -147,7 +147,6 @@ describe('createSummaryBody', () => { expect(string).toContain('>+25'); expect(string).toContain('>0'); - console.log(string); summary.clear(); }); diff --git a/test/unit/github/annotations.test.ts b/test/unit/github/annotations.test.ts index ba8c3102..c840b89e 100644 --- a/test/unit/github/annotations.test.ts +++ b/test/unit/github/annotations.test.ts @@ -1,9 +1,18 @@ import { describe, expect, it, jest } from '@jest/globals'; import { deletePreviousReviewComments, getPostedReviewComments, postAnnotations } from '../../../src/github/annotations'; -import { emptyComment, fourMixedAnalysisResults, twoMixedAnalysisResults, warningComment } from './objects/annotations'; +import { + emptyComment, + fiveMixedAnalysisResults, + fourMixedAnalysisResults, + twohundredAnnotations, + twoMixedAnalysisResults, + warningComment +} from './objects/annotations'; import { logger } from '../../../src/helper/logger'; import { octokit } from '../../../src/github/octokit'; import { actionConfigMock, githubConfigMock } from '../../.setup/mock'; +import { EOL } from 'os'; +import { SpiedFunction } from 'jest-mock'; describe('getPostedReviewComments', () => { it('should throw error when a pullRequestNumber is not present', async () => { @@ -95,100 +104,271 @@ describe('deletePreviousReviewComments', () => { }); describe('postAnnotations', () => { - it('should post two annotations when showBlockingAfter is true', () => { - const warningSpy = jest.spyOn(logger, 'warning'); - const noticeSpy = jest.spyOn(logger, 'notice'); + let createCheckSpy: jest.SpiedFunction; + let updateCheckSpy: jest.SpiedFunction; + let warningSpy: jest.SpiedFunction; + let infoSpy: jest.SpiedFunction; + + beforeEach(() => { + createCheckSpy = jest.spyOn(octokit.rest.checks, 'create'); + updateCheckSpy = jest.spyOn(octokit.rest.checks, 'update'); + warningSpy = jest.spyOn(logger, 'warning'); + infoSpy = jest.spyOn(logger, 'info'); + }); - actionConfigMock.showBlockingAfter = true; + afterEach(() => { + jest.resetAllMocks(); + }); - postAnnotations(twoMixedAnalysisResults.projectResults); + it('should return if no head_sha is present', async () => { + const headSha = githubConfigMock.headSha; + githubConfigMock.headSha = ''; - expect(warningSpy).toHaveBeenCalledTimes(1); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path0.js', - title: 'message 0', - startLine: 0 - }); + await postAnnotations(twoMixedAnalysisResults.projectResults); - expect(noticeSpy).toHaveBeenCalledTimes(1); - expect(noticeSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking after'), { - file: 'path1.js', - title: 'message 1', - startLine: 1 - }); + expect(warningSpy).toHaveBeenCalledWith('Commit of underlying commit not found, cannot post annotations'); + githubConfigMock.headSha = headSha; }); - it('should post four annotations when showBlockingAfter is true', () => { - const warningSpy = jest.spyOn(logger, 'warning'); - const noticeSpy = jest.spyOn(logger, 'notice'); + it('should return if no annotations are present', async () => { + const test = structuredClone(twoMixedAnalysisResults.projectResults); + test[0].annotations = []; + await postAnnotations(test); - actionConfigMock.showBlockingAfter = true; + expect(infoSpy).toHaveBeenCalledWith('No annotations to post.'); + }); - postAnnotations(fourMixedAnalysisResults.projectResults); + it('should post two annotations when showBlockingAfter is true', async () => { + actionConfigMock.showBlockingAfter = true; - expect(warningSpy).toHaveBeenCalledTimes(2); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path0.js', - title: 'message 0', - startLine: 0 - }); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path2.js', - title: 'message 2', - startLine: 2 + await postAnnotations(twoMixedAnalysisResults.projectResults); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(createCheckSpy).toHaveBeenCalledWith({ + conclusion: 'success', + head_sha: 'head-sha-256', + name: 'TICS annotations', + output: { + annotations: [ + { + annotation_level: 'warning', + end_line: 0, + message: `Blocking${EOL}Line: 0`, + path: 'path0.js', + start_line: 0, + title: 'message 0' + }, + { + annotation_level: 'notice', + end_line: 1, + message: `Blocking after: 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, + path: 'path1.js', + start_line: 1, + title: 'message 1' + } + ], + summary: '', + title: 'TICS annotations' + }, + owner: 'tester', + repo: 'test', + status: undefined }); + expect(updateCheckSpy).toHaveBeenCalledTimes(0); + }); - expect(noticeSpy).toHaveBeenCalledTimes(2); - expect(noticeSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking after'), { - file: 'path1.js', - title: 'message 1', - startLine: 1 - }); - expect(noticeSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking after'), { - file: 'path3.js', - title: 'message 3', - startLine: 3 + it('should post four annotations when showBlockingAfter is true', async () => { + actionConfigMock.showBlockingAfter = true; + + await postAnnotations(fourMixedAnalysisResults.projectResults); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(createCheckSpy).toHaveBeenCalledWith({ + conclusion: 'success', + head_sha: 'head-sha-256', + name: 'TICS annotations', + output: { + annotations: [ + { + annotation_level: 'warning', + end_line: 0, + message: `Blocking${EOL}Line: 0`, + path: 'path0.js', + start_line: 0, + title: 'message 0' + }, + { + annotation_level: 'notice', + end_line: 1, + message: `Blocking after: 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, + path: 'path1.js', + start_line: 1, + title: 'message 1' + }, + { + annotation_level: 'warning', + end_line: 2, + message: `Blocking${EOL}Level: 2, Category: category 2${EOL}Line: 2, Rule: rule 2`, + path: 'path2.js', + start_line: 2, + title: 'message 2' + }, + { + annotation_level: 'notice', + end_line: 3, + message: `Blocking after${EOL}Level: 2, Category: category 3${EOL}Line: 3, Rule: rule 3${EOL}synopsis 3${EOL}Rule-help: https://ruleset/rule+3`, + path: 'path3.js', + start_line: 3, + title: 'message 3' + } + ], + summary: '', + title: 'TICS annotations' + }, + owner: 'tester', + repo: 'test', + status: undefined }); + expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post only a blocking annotation when showBlockingAfter is false', () => { - const warningSpy = jest.spyOn(logger, 'warning'); - const noticeSpy = jest.spyOn(logger, 'notice'); - + it('should post only a blocking annotation when showBlockingAfter is false', async () => { actionConfigMock.showBlockingAfter = false; - postAnnotations(twoMixedAnalysisResults.projectResults); - - expect(warningSpy).toHaveBeenCalledTimes(1); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path0.js', - title: 'message 0', - startLine: 0 + await postAnnotations(twoMixedAnalysisResults.projectResults); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(createCheckSpy).toHaveBeenCalledWith({ + conclusion: 'success', + head_sha: 'head-sha-256', + name: 'TICS annotations', + output: { + annotations: [ + { + annotation_level: 'warning', + end_line: 0, + message: `Blocking${EOL}Line: 0`, + path: 'path0.js', + start_line: 0, + title: 'message 0' + } + ], + summary: '', + title: 'TICS annotations' + }, + owner: 'tester', + repo: 'test', + status: undefined }); - expect(noticeSpy).toHaveBeenCalledTimes(0); + expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post only two blocking annotations when showBlockingAfter is false', () => { - const warningSpy = jest.spyOn(logger, 'warning'); - const noticeSpy = jest.spyOn(logger, 'notice'); - + it('should post only two annotations when showBlockingAfter and includeNonBlockingAnnotations are false', async () => { actionConfigMock.showBlockingAfter = false; + actionConfigMock.includeNonBlockingAnnotations = false; + + await postAnnotations(fiveMixedAnalysisResults.projectResults); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(createCheckSpy).toHaveBeenCalledWith({ + conclusion: 'success', + head_sha: 'head-sha-256', + name: 'TICS annotations', + output: { + annotations: [ + { + annotation_level: 'warning', + end_line: 0, + message: `Blocking${EOL}Line: 0`, + path: 'path0.js', + start_line: 0, + title: 'message 0' + }, + { + annotation_level: 'warning', + end_line: 2, + message: `Blocking${EOL}Level: 2, Category: category 2${EOL}Line: 2, Rule: rule 2`, + path: 'path2.js', + start_line: 2, + title: 'message 2' + } + ], + summary: '', + title: 'TICS annotations' + }, + owner: 'tester', + repo: 'test', + status: undefined + }); - postAnnotations(fourMixedAnalysisResults.projectResults); + expect(updateCheckSpy).toHaveBeenCalledTimes(0); + }); - expect(warningSpy).toHaveBeenCalledTimes(2); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path0.js', - title: 'message 0', - startLine: 0 - }); - expect(warningSpy).toHaveBeenCalledWith(expect.stringContaining('Blocking'), { - file: 'path2.js', - title: 'message 2', - startLine: 2 + it('should post three annotations when showBlockingAfter is false and includeNonBlockingAnnotations is true', async () => { + actionConfigMock.showBlockingAfter = false; + actionConfigMock.includeNonBlockingAnnotations = true; + + await postAnnotations(fiveMixedAnalysisResults.projectResults); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(createCheckSpy).toHaveBeenCalledWith({ + conclusion: 'success', + head_sha: 'head-sha-256', + name: 'TICS annotations', + output: { + annotations: [ + { + annotation_level: 'warning', + end_line: 0, + message: `Blocking${EOL}Line: 0`, + path: 'path0.js', + start_line: 0, + title: 'message 0' + }, + { + annotation_level: 'warning', + end_line: 2, + message: `Blocking${EOL}Level: 2, Category: category 2${EOL}Line: 2, Rule: rule 2`, + path: 'path2.js', + start_line: 2, + title: 'message 2' + }, + { + annotation_level: 'notice', + end_line: 2, + message: `Non-Blocking${EOL}Level: 2, Category: category 2${EOL}Line: 2, Rule: rule 2`, + path: 'path2.js', + start_line: 2, + title: 'message 2' + } + ], + summary: '', + title: 'TICS annotations' + }, + owner: 'tester', + repo: 'test', + status: undefined }); - expect(noticeSpy).toHaveBeenCalledTimes(0); + expect(updateCheckSpy).toHaveBeenCalledTimes(0); + }); + + it('should post 200 annotations if all are postable', async () => { + (createCheckSpy as SpiedFunction).mockResolvedValue({ data: { id: 1234 } }); + + await postAnnotations(twohundredAnnotations()); + + expect(createCheckSpy).toHaveBeenCalledTimes(1); + expect(updateCheckSpy).toHaveBeenCalledTimes(3); + expect(updateCheckSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ + check_run_id: 1234, + conclusion: 'success', + output: expect.objectContaining({ + annotations: expect.arrayContaining(new Array(50).fill(expect.any(Object))) + }) + }) + ); }); }); diff --git a/test/unit/github/objects/annotations.ts b/test/unit/github/objects/annotations.ts index 7d8b4f80..0ad7ef5d 100644 --- a/test/unit/github/objects/annotations.ts +++ b/test/unit/github/objects/annotations.ts @@ -1,5 +1,6 @@ import { Links, ReviewComment, User } from '../../../../src/github/interfaces'; -import { AnalysisResult, ExtendedAnnotation, TicsReviewComment } from '../../../../src/helper/interfaces'; +import { AnalysisResult, ProjectResult } from '../../../../src/helper/interfaces'; +import { ExtendedAnnotation } from '../../../../src/viewer/interfaces'; export const user: User = { login: '', @@ -101,7 +102,8 @@ export const analysisResults: AnalysisResult = { blocking: { state: 'yes' }, - instanceName: 'CS' + instanceName: 'CS', + postable: false } ], qualityGate: { @@ -191,8 +193,7 @@ const fourAnnotations: ExtendedAnnotation[] = [ gateId: 1, displayCount: '1x', blocking: { - state: 'after', - after: 1757429236 + state: 'after' }, instanceName: 'CS', postable: true, @@ -224,9 +225,11 @@ export const twoMixedAnalysisResults: AnalysisResult = { gateId: 1, displayCount: '1x', blocking: { - state: 'yes' + state: 'no' }, - instanceName: 'CS' + instanceName: 'CS', + postable: true, + path: '' } ], qualityGate: { @@ -267,7 +270,8 @@ export const fourMixedAnalysisResults: AnalysisResult = { state: 'yes' }, instanceName: 'CS', - postable: false + postable: false, + path: '' } ], qualityGate: { @@ -281,3 +285,84 @@ export const fourMixedAnalysisResults: AnalysisResult = { ], passedWithWarning: false }; + +export const fiveMixedAnalysisResults: AnalysisResult = { + passed: false, + message: 'failed', + projectResults: [ + { + project: '', + explorerUrl: '', + analyzedFiles: [], + annotations: [ + ...fourAnnotations, + { + fullPath: 'HIE://project/branch/path2.js', + line: 2, + level: 2, + category: 'category 2', + rule: 'rule 2', + msg: 'message 2', + supp: false, + type: 'type 2', + count: 1, + gateId: 1, + displayCount: '1x', + blocking: { + state: 'no' + }, + instanceName: 'CS', + postable: true, + path: 'path2.js' + } + ], + qualityGate: { + passed: false, + message: '', + url: '', + gates: [], + annotationsApiV1Links: [] + } + } + ], + passedWithWarning: false +}; + +export const twohundredAnnotations = () => { + const projectResults: ProjectResult[] = [ + { + project: '', + explorerUrl: '', + qualityGate: { + passed: false, + message: '', + url: '', + gates: [], + annotationsApiV1Links: [] + }, + analyzedFiles: [], + annotations: [] + } + ]; + + for (let i = 0; i < 200; i++) { + projectResults[0].annotations.push({ + fullPath: `HIE://path${0}.js`, + path: `path${i}.js`, + line: i, + msg: `message ${i}`, + supp: false, + type: `type ${i}`, + count: 1, + gateId: 1, + displayCount: '1x', + blocking: { + state: 'yes' + }, + ruleset: `Coding Standard ${i}`, + instanceName: 'CS', + postable: true + }); + } + return projectResults; +}; From 60e332061e26a2e6e2316951dcb70f449a03de0c Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:30:28 +0100 Subject: [PATCH 18/22] #35162: Renamed new option to showNonBlocking, matched functionality of showBlockinAfter with it Blocking after annotations are now only retrieved when `showBlockingAfter` is true --- README.md | 31 +- action.yaml | 10 +- dist/index.js | 3560 ++++++++++++------------ src/configuration/action.ts | 4 +- src/github/annotations.ts | 2 +- src/viewer/annotations.ts | 18 +- test/.setup/mock.ts | 4 +- test/integration/configuration.test.ts | 2 +- test/integration/httpclient.test.ts | 2 +- test/integration/octokit.test.ts | 2 +- test/unit/github/annotations.test.ts | 8 +- test/unit/viewer/annotations.test.ts | 2 +- 12 files changed, 1835 insertions(+), 1810 deletions(-) diff --git a/README.md b/README.md index ecb74afe..a3bd1a99 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ The following options allow to instrument TICS Client more specifically: | `codetype` | Allows you to pick which specific types of code you want to analyze with the TICS client. Options are `PRODUCTION`, `TESTCODE`, `EXTERNAL` and `GENERATED`. | `PRODUCTION` | | `excludeMovedFiles` | Exclude moved files from analysis even if there are modifications in the file. | `false` | | `showBlockingAfter` | Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | +| `showNonBlocking` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | | `tmpdir` | Location to store debug information. | - | ## QServer @@ -148,15 +149,16 @@ The following inputs are recommended or required for this action: The following options allow to instrument TICSQServer more specifically: -| Input | Description | Default | -| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. | `ALL` | -| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. | - | -| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | -| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | -| `branchname` | Name of the branch in TICS. | - | -| `showBlockingAfter` | Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | -| `tmpdir` | Location to store debug information. | - | +| Input | Description | Default | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | +| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. | `ALL` | +| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. | - | +| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | +| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | +| `branchname` | Name of the branch in TICS. | - | +| `showBlockingAfter` | Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | +| `showNonBlocking` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | +| `tmpdir` | Location to store debug information. | - | ## Other features @@ -164,12 +166,11 @@ The following options allow to instrument TICSQServer more specifically: Below are some special parameters that can be used to control how the GitHub Action posts its results: -| Input | Description | Default | -| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `postAnnotations` | Show the TICS violations in the changed files window. Options are `true` or `false`. | `true` | -| `includeNonBlockingAnnotations` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | -| `postToConversation` | Post the summary to the conversation page of the pull request. | `true` | -| `pullRequestApproval` | Set the plugin to approve or deny a pull request, by default this is false. Options are `true` or `false`. Note that once a run that added a reviewer has been completed, this reviewer cannot be deleted from that pull request. (Always the case on versions between TICS GitHub Action 2.0.0 and 2.5.0). | `false` | +| Input | Description | Default | +| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `postAnnotations` | Show the TICS violations in the changed files window. Options are `true` or `false`. | `true` | +| `postToConversation` | Post the summary to the conversation page of the pull request. | `true` | +| `pullRequestApproval` | Set the plugin to approve or deny a pull request, by default this is false. Options are `true` or `false`. Note that once a run that added a reviewer has been completed, this reviewer cannot be deleted from that pull request. (Always the case on versions between TICS GitHub Action 2.0.0 and 2.5.0). | `false` | ### Infrastructural and Security related parameters diff --git a/action.yaml b/action.yaml index 22ec4a14..e8953a93 100644 --- a/action.yaml +++ b/action.yaml @@ -67,10 +67,6 @@ inputs: description: Show the TICS violations in the changed files window. Options are `true` or `false` (default is `true`). required: false default: true - includeNonBlockingAnnotations: - description: Include non-blocking TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `false`). - required: false - default: false postToConversation: description: Post the summary to the conversation page of the pull request. Options are `true` (default) or `false`. required: false @@ -86,9 +82,13 @@ inputs: description: Comma-seperated list of extra secrets to mask in the console output. required: false showBlockingAfter: - description: Show the blocking after violations in the changed files window. Options are `true` or `false` (default is `true`). + description: Show the blocking after TICS violations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `true`). required: false default: true + showNonBlocking: + description: Show non-blocking TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `false`). + required: false + default: false ticsAuthToken: description: Authentication token to authorize the plugin when it connects to the TICS Viewer. required: false diff --git a/dist/index.js b/dist/index.js index aaa2c1b6..5c686b2d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -881,21 +881,21 @@ const logger_1 = __nccwpck_require__(66113); class ActionConfiguration { excludeMovedFiles; postAnnotations; - includeNonBlockingAnnotations; postToConversation; pullRequestApproval; retryConfig; secretsFilter; showBlockingAfter; + showNonBlocking; constructor() { this.excludeMovedFiles = (0, core_1.getBooleanInput)('excludeMovedFiles'); this.postAnnotations = (0, core_1.getBooleanInput)('postAnnotations'); - this.includeNonBlockingAnnotations = (0, core_1.getBooleanInput)('includeNonBlockingAnnotations'); this.postToConversation = (0, core_1.getBooleanInput)('postToConversation'); this.pullRequestApproval = (0, core_1.getBooleanInput)('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig((0, core_1.getInput)('retryCodes')); this.secretsFilter = this.getSecretsFilter((0, core_1.getInput)('secretsFilter')); this.showBlockingAfter = (0, core_1.getBooleanInput)('showBlockingAfter'); + this.showNonBlocking = (0, core_1.getBooleanInput)('showNonBlocking'); } /** * Validates if the given input are valid retry codes and returns them. @@ -1521,7 +1521,7 @@ function shouldPostAnnotation(annotation) { (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes' || (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) || - (annotation.blocking.state === 'no' && config_1.actionConfig.includeNonBlockingAnnotations))); + (annotation.blocking.state === 'no' && config_1.actionConfig.showNonBlocking))); } function createGithubAnnotation(annotation) { const title = annotation.msg; @@ -2024,28 +2024,28 @@ async function getChangedFilesOfPullRequestQL() { }; let response; try { - response = await octokit_1.octokit.graphql.paginate(`query changedFiles($owner: String!, $repo: String!, $pull_number: Int!, $per_page: Int!, $cursor: String) { - rateLimit { - remaining - } - repository(owner: $owner, name: $repo) { - pullRequest(number: $pull_number) { - files(first: $per_page, after: $cursor) { - totalCount - nodes { - path - changeType - additions - deletions - viewerViewedState - } - pageInfo { - hasNextPage - endCursor - } - } - } - } + response = await octokit_1.octokit.graphql.paginate(`query changedFiles($owner: String!, $repo: String!, $pull_number: Int!, $per_page: Int!, $cursor: String) { + rateLimit { + remaining + } + repository(owner: $owner, name: $repo) { + pullRequest(number: $pull_number) { + files(first: $per_page, after: $cursor) { + totalCount + nodes { + path + changeType + additions + deletions + viewerViewedState + } + pageInfo { + hasNextPage + endCursor + } + } + } + } }`, params); logger_1.logger.debug(JSON.stringify(response)); } @@ -2847,8 +2847,9 @@ async function fetchAnnotationsWithApiLinks(apiLinks) { async function fetchAnnotationsByRun(identifier) { const annotationsUrl = new URL(`${config_1.ticsConfig.baseUrl}/api/public/v1/Annotations?metric=QualityGate()`); let filters = `Project(${identifier.project})`; - if (!config_1.actionConfig.includeNonBlockingAnnotations) { - filters += ',AnnotationSeverity(Set(blocking,after))'; + const annotationSeverity = getAnnotationSeverity(); + if (annotationSeverity) { + filters += `,${annotationSeverity}`; } if (identifier.cdtoken) { filters += `,ClientData(${identifier.cdtoken})`; @@ -2860,6 +2861,15 @@ async function fetchAnnotationsByRun(identifier) { annotationsUrl.searchParams.set('filters', filters); return fetchAnnotations(annotationsUrl); } +function getAnnotationSeverity() { + if (config_1.actionConfig.showNonBlocking) { + return undefined; + } + if (config_1.actionConfig.showBlockingAfter) { + return 'AnnotationSeverity(Set(blocking,after))'; + } + return 'AnnotationSeverity(blocking)'; +} async function fetchAnnotations(annotationsUrl, gateId) { const fields = annotationsUrl.searchParams.get('fields'); const requiredFields = 'default,ruleHelp,synopsis,ruleset,blocking'; @@ -135349,457 +135359,457 @@ function copy (src) { /***/ 61860: /***/ ((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, Symbol, Reflect, Promise, SuppressedError, Iterator */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -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; -var __addDisposableResource; -var __disposeResources; -var __rewriteRelativeImportExtension; -(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); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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 = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; - function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } - function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } - 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: false } : 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; - }; - - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; - - __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); - }; - - __addDisposableResource = function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - }; - - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - __disposeResources = function (env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; - - __rewriteRelativeImportExtension = function (path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) { - return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); - }); - } - return path; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - 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); - exporter("__addDisposableResource", __addDisposableResource); - exporter("__disposeResources", __disposeResources); - exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension); -}); - -0 && (0); +/****************************************************************************** +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, Symbol, Reflect, Promise, SuppressedError, Iterator */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +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; +var __addDisposableResource; +var __disposeResources; +var __rewriteRelativeImportExtension; +(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); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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 = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + 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: false } : 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; + }; + + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; + + __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); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; + + __rewriteRelativeImportExtension = function (path, preserveJsx) { + if (typeof path === "string" && /^\.\.?\//.test(path)) { + return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { + return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); + }); + } + return path; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + 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); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); + exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension); +}); + +0 && (0); /***/ }), @@ -159974,1303 +159984,1303 @@ exports.parseURL = __nccwpck_require__(20905).parseURL; /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; - -const punycode = __nccwpck_require__(24876); -const tr46 = __nccwpck_require__(1552); - -const specialSchemes = { - ftp: 21, - file: null, - gopher: 70, - http: 80, - https: 443, - ws: 80, - wss: 443 -}; - -const failure = Symbol("failure"); - -function countSymbols(str) { - return punycode.ucs2.decode(str).length; -} - -function at(input, idx) { - const c = input[idx]; - return isNaN(c) ? undefined : String.fromCodePoint(c); -} - -function isASCIIDigit(c) { - return c >= 0x30 && c <= 0x39; -} - -function isASCIIAlpha(c) { - return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); -} - -function isASCIIAlphanumeric(c) { - return isASCIIAlpha(c) || isASCIIDigit(c); -} - -function isASCIIHex(c) { - return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); -} - -function isSingleDot(buffer) { - return buffer === "." || buffer.toLowerCase() === "%2e"; -} - -function isDoubleDot(buffer) { - buffer = buffer.toLowerCase(); - return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; -} - -function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); -} - -function isWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); -} - -function isNormalizedWindowsDriveLetterString(string) { - return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; -} - -function containsForbiddenHostCodePoint(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function containsForbiddenHostCodePointExcludingPercent(string) { - return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; -} - -function isSpecialScheme(scheme) { - return specialSchemes[scheme] !== undefined; -} - -function isSpecial(url) { - return isSpecialScheme(url.scheme); -} - -function defaultPort(scheme) { - return specialSchemes[scheme]; -} - -function percentEncode(c) { - let hex = c.toString(16).toUpperCase(); - if (hex.length === 1) { - hex = "0" + hex; - } - - return "%" + hex; -} - -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; - - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); - } - - return str; -} - -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); -} - -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; -} - -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); -} - -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} - -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); - - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); - } - - return cStr; -} - -function parseIPv4Number(input) { - let R = 10; - - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } - - if (input === "") { - return 0; - } - - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { - return failure; - } - - return parseInt(input, R); -} - -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } - - if (parts.length > 4) { - return input; - } - - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; - } - const n = parseIPv4Number(part); - if (n === failure) { - return input; - } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; - } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { - return failure; - } - - let ipv4 = numbers.pop(); - let counter = 0; - - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; - } - - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; - - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); - } - - return output; -} - -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; - - input = punycode.ucs2.decode(input); - - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } - - pointer += 2; - ++pieceIndex; - compress = pieceIndex; - } - - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } - - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; - } - - let value = 0; - let length = 0; - - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } - - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } - - pointer -= length; - - if (pieceIndex > 6) { - return failure; - } - - let numbersSeen = 0; - - while (input[pointer] !== undefined) { - let ipv4Piece = null; - - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } - - if (!isASCIIDigit(input[pointer])) { - return failure; - } - - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } - - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; - - ++numbersSeen; - - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } - - if (numbersSeen !== 4) { - return failure; - } - - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { - return failure; - } - } else if (input[pointer] !== undefined) { - return failure; - } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; - } - } else if (compress === null && pieceIndex !== 8) { - return failure; - } - - return address; -} - -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; - - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } - - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; - } - - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; - } - } - - return output; -} - -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; - } - - return parseIPv6(input.substring(1, input.length - 1)); - } - - if (!isSpecialArg) { - return parseOpaqueHost(input); - } - - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } - - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } - - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; - } - - return asciiDomain; -} - -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } - - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); - } - return output; -} - -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; - - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; - } - ++currLen; - } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} - -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } - - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; - } - - return host; -} - -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} - -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} - -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; - } - - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} - -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} - -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} - -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; - - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, - - cannotBeABaseURL: false - }; - - const res = trimControlChars(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - } - - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; - } - this.input = res; - - this.state = stateOverride || "scheme start"; - - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; - - this.input = punycode.ucs2.decode(this.input); - - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); - - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; - } - } -} - -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } - - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } - - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } - - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); - - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; - } - - return true; -}; - -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; - } - this.atFlag = true; - - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); - - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; - } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; - } - } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } - - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } - - return true; -}; - -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; - - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } - - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } - } - this.state = "path"; - --this.pointer; - } - - return true; -}; - -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; - } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - if (host === "localhost") { - host = ""; - } - this.url.host = host; - - if (this.stateOverride) { - return false; - } - - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; - - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } - - return true; -}; - -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } - - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; - } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); - } - } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } - - return true; -}; - -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } - - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } - - return true; -}; - -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } - - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } - - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.buffer += cStr; - } - - return true; -}; - -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } - - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } - - return true; -}; - -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; - - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } - - output += serializeHost(url.host); - - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } - - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } - - if (url.query !== null) { - output += "?" + url.query; - } - - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } - - return output; -} - -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); - - if (tuple.port !== null) { - result += ":" + tuple.port; - } - - return result; -} - -module.exports.serializeURL = serializeURL; - -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; - -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } - - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } - - return usm.url; -}; - -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; - -module.exports.serializeHost = serializeHost; - -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - -module.exports.serializeInteger = function (integer) { - return String(integer); -}; - -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } - - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; + +const punycode = __nccwpck_require__(24876); +const tr46 = __nccwpck_require__(1552); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; /***/ }), diff --git a/src/configuration/action.ts b/src/configuration/action.ts index f771f906..6024130d 100644 --- a/src/configuration/action.ts +++ b/src/configuration/action.ts @@ -7,22 +7,22 @@ import { logger } from '../helper/logger'; export class ActionConfiguration { readonly excludeMovedFiles: boolean; readonly postAnnotations: boolean; - readonly includeNonBlockingAnnotations: boolean; readonly postToConversation: boolean; readonly pullRequestApproval: boolean; readonly retryConfig: RetryConfig; readonly secretsFilter: string[]; readonly showBlockingAfter: boolean; + readonly showNonBlocking: boolean; constructor() { this.excludeMovedFiles = getBooleanInput('excludeMovedFiles'); this.postAnnotations = getBooleanInput('postAnnotations'); - this.includeNonBlockingAnnotations = getBooleanInput('includeNonBlockingAnnotations'); this.postToConversation = getBooleanInput('postToConversation'); this.pullRequestApproval = getBooleanInput('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig(getInput('retryCodes')); this.secretsFilter = this.getSecretsFilter(getInput('secretsFilter')); this.showBlockingAfter = getBooleanInput('showBlockingAfter'); + this.showNonBlocking = getBooleanInput('showNonBlocking'); } /** diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 5fea575d..793801bd 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -102,7 +102,7 @@ function shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { (annotation.blocking?.state === undefined || annotation.blocking.state === 'yes' || (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) || - (annotation.blocking.state === 'no' && actionConfig.includeNonBlockingAnnotations)) + (annotation.blocking.state === 'no' && actionConfig.showNonBlocking)) ); } diff --git a/src/viewer/annotations.ts b/src/viewer/annotations.ts index 9234c815..ab5129c2 100644 --- a/src/viewer/annotations.ts +++ b/src/viewer/annotations.ts @@ -59,8 +59,10 @@ async function fetchAnnotationsByRun(identifier: TicsRunIdentifier): Promise { const fields = annotationsUrl.searchParams.get('fields'); const requiredFields = 'default,ruleHelp,synopsis,ruleset,blocking'; diff --git a/test/.setup/mock.ts b/test/.setup/mock.ts index 75e1a85b..4f64b8bf 100644 --- a/test/.setup/mock.ts +++ b/test/.setup/mock.ts @@ -62,10 +62,10 @@ export const actionConfigMock = { secretsFilter: ['random'], excludeMovedFiles: false, postAnnotations: false, - includeNonBlockingAnnotations: false, postToConversation: false, pullRequestApproval: false, - showBlockingAfter: false + showBlockingAfter: false, + showNonBlocking: false }; export const ticsCliMock = { diff --git a/test/integration/configuration.test.ts b/test/integration/configuration.test.ts index 45775acc..38f29522 100644 --- a/test/integration/configuration.test.ts +++ b/test/integration/configuration.test.ts @@ -7,7 +7,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; -process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; +process.env.INPUT_SHOWNONBLOCKING = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/integration/httpclient.test.ts b/test/integration/httpclient.test.ts index 839acd76..05e2ce34 100644 --- a/test/integration/httpclient.test.ts +++ b/test/integration/httpclient.test.ts @@ -20,7 +20,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; -process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; +process.env.INPUT_SHOWNONBLOCKING = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/integration/octokit.test.ts b/test/integration/octokit.test.ts index 9365e371..1ec883b9 100644 --- a/test/integration/octokit.test.ts +++ b/test/integration/octokit.test.ts @@ -22,7 +22,7 @@ process.env.INPUT_VIEWERURL = 'http://localhost/tiobeweb/TICS/api/cfg?name=defau process.env.INPUT_EXCLUDEMOVEDFILES = 'false'; process.env.INPUT_INSTALLTICS = 'false'; process.env.INPUT_POSTANNOTATIONS = 'false'; -process.env.INPUT_INCLUDENONBLOCKINGANNOTATIONS = 'false'; +process.env.INPUT_SHOWNONBLOCKING = 'false'; process.env.INPUT_POSTTOCONVERSATION = 'false'; process.env.INPUT_PULLREQUESTAPPROVAL = 'false'; process.env.INPUT_SHOWBLOCKINGAFTER = 'true'; diff --git a/test/unit/github/annotations.test.ts b/test/unit/github/annotations.test.ts index c840b89e..6edfe54d 100644 --- a/test/unit/github/annotations.test.ts +++ b/test/unit/github/annotations.test.ts @@ -264,9 +264,9 @@ describe('postAnnotations', () => { expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post only two annotations when showBlockingAfter and includeNonBlockingAnnotations are false', async () => { + it('should post only two annotations when showBlockingAfter and showNonBlocking are false', async () => { actionConfigMock.showBlockingAfter = false; - actionConfigMock.includeNonBlockingAnnotations = false; + actionConfigMock.showNonBlocking = false; await postAnnotations(fiveMixedAnalysisResults.projectResults); @@ -305,9 +305,9 @@ describe('postAnnotations', () => { expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post three annotations when showBlockingAfter is false and includeNonBlockingAnnotations is true', async () => { + it('should post three annotations when showBlockingAfter is false and showNonBlocking is true', async () => { actionConfigMock.showBlockingAfter = false; - actionConfigMock.includeNonBlockingAnnotations = true; + actionConfigMock.showNonBlocking = true; await postAnnotations(fiveMixedAnalysisResults.projectResults); diff --git a/test/unit/viewer/annotations.test.ts b/test/unit/viewer/annotations.test.ts index 44a23fc6..6183a39c 100644 --- a/test/unit/viewer/annotations.test.ts +++ b/test/unit/viewer/annotations.test.ts @@ -156,7 +156,7 @@ describe('fetchAllAnnotations', () => { const response = await fetchAllAnnotations(qualityGate, identifier); expect(httpClientSpy).toHaveBeenCalledWith( - 'http://base.url/api/public/v1/Annotations?metric=QualityGate%28%29&filters=Project%28project%29%2CAnnotationSeverity%28Set%28blocking%2Cafter%29%29%2CClientData%28test%29%2CWindow%28-1%29&fields=default%2CruleHelp%2Csynopsis%2Cruleset%2Cblocking' + 'http://base.url/api/public/v1/Annotations?metric=QualityGate%28%29&filters=Project%28project%29%2CAnnotationSeverity%28blocking%29%2CClientData%28test%29%2CWindow%28-1%29&fields=default%2CruleHelp%2Csynopsis%2Cruleset%2Cblocking' ); expect(response).toEqual([ { type: 'CS', line: 1, count: 1, instanceName: 'Coding Standard Violations', fullPath: 'HIE://project/branch/file.js', path: 'file.js' }, From c5eb22bb71cdda308ff6ae38acf647ff5ca2b003 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Mon, 10 Nov 2025 17:32:45 +0100 Subject: [PATCH 19/22] #35162: Merged main into branch --- dist/index.js | 228 +++--------------------------- package-lock.json | 20 +-- package.json | 2 +- test/unit/helper/response.test.ts | 4 +- 4 files changed, 26 insertions(+), 228 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5c686b2d..ad5ec793 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2986,7 +2986,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.httpClient = void 0; -const http_client_1 = __importDefault(__nccwpck_require__(99957)); +const http_client_1 = __importDefault(__nccwpck_require__(22338)); const proxy_agent_1 = __nccwpck_require__(75273); const config_1 = __nccwpck_require__(34151); exports.httpClient = new http_client_1.default(true, { @@ -46065,7 +46065,7 @@ exports.ReflectionTypeCheck = ReflectionTypeCheck; /***/ }), -/***/ 99957: +/***/ 22338: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -46150,22 +46150,22 @@ class HttpClient { return result; } catch (error) { - throw new retry_1.RequestError(`${error}: ${text}`, response.retryCount); + throw new retry_1.RequestError(`${error}: ${text}`, response.status, response.retryCount); } case 302: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.status, response.retryCount); case 400: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. ${(yield response.json()).alertMessages[0].header}`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. ${(yield response.json()).alertMessages[0].header}`, response.status, response.retryCount); case 401: let authUrl = url.split('/api/')[0]; authUrl += this.ci ? '/Administration.html#page=authToken' : '/UserSettings.html#page=authToken'; - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please provide a valid TICS authentication token. See ${authUrl}`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please provide a valid TICS authentication token. See ${authUrl}`, response.status, response.retryCount); case 403: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Forbidden call: ${url}`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Forbidden call: ${url}`, response.status, response.retryCount); case 404: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.status, response.retryCount); default: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}: ${response.statusText}`, response.retryCount); + throw new retry_1.RequestError(`HTTP request failed with status ${response.status}: ${response.statusText}`, response.status, response.retryCount); } }); } @@ -46181,11 +46181,13 @@ exports["default"] = HttpClient; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.fetchBuilder = exports.RequestError = void 0; +exports.RequestError = void 0; +exports.fetchBuilder = fetchBuilder; class RequestError extends Error { - constructor(message, retryCount) { + constructor(message, status, retryCount) { super(message); this.name = 'RequestError'; + this.status = status; this.retryCount = retryCount; } } @@ -46238,7 +46240,7 @@ function fetchBuilder(fetchFunc, params = {}) { retry(attempt, error, null); } else { - reject(new RequestError(error.message, attempt)); + reject(new RequestError(error.message, 0, attempt)); } }); }; @@ -46251,7 +46253,6 @@ function fetchBuilder(fetchFunc, params = {}) { }); }; } -exports.fetchBuilder = fetchBuilder; exports["default"] = fetchBuilder; //# sourceMappingURL=retry.js.map @@ -46301,7 +46302,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.InstallTics = void 0; exports.getBaseUrl = getBaseUrl; const os = __importStar(__nccwpck_require__(70857)); -const http_client_1 = __importDefault(__nccwpck_require__(87507)); +const http_client_1 = __importDefault(__nccwpck_require__(22338)); var Platform; (function (Platform) { Platform["aix"] = "aix"; @@ -46422,199 +46423,6 @@ exports.InstallTics = InstallTics; /***/ }), -/***/ 87507: -/***/ (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; - 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]; -})); -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 })); -const node_fetch_1 = __importStar(__nccwpck_require__(26705)); -const retry_1 = __importStar(__nccwpck_require__(9277)); -class HttpClient { - /** - * @param ci If this http client is used in a ci environment. - * @param options (Optional) options to use for the HttpClient. - * @param agent (Optional) agent to be set when using proxy. - */ - constructor(ci, options, agent) { - this.ci = ci; - this.agent = agent; - this.defaultHeaders = new node_fetch_1.Headers(); - if (options === null || options === void 0 ? void 0 : options.authToken) { - this.defaultHeaders.set('authorization', `Basic ${options.authToken}`); - } - if (options === null || options === void 0 ? void 0 : options.xRequestWithTics) { - this.defaultHeaders.set('x-requested-with', 'TICS'); - } - this.customFetch = (0, retry_1.default)(node_fetch_1.default, options === null || options === void 0 ? void 0 : options.retry); - } - /** - * Executes a GET request to the given url. - * @param url api url to perform a GET request for. - */ - get(url, headers) { - return __awaiter(this, void 0, void 0, function* () { - let fixedHeaders = this.defaultHeaders; - headers === null || headers === void 0 ? void 0 : headers.forEach((value, key) => { - fixedHeaders.append(key, value); - }); - const requestInit = { - agent: this.agent, - headers: fixedHeaders - }; - const response = yield this.customFetch(url, requestInit); - switch (response.status) { - case 200: - const text = yield response.text(); - try { - const result = { - status: response.status, - retryCount: response.retryCount, - data: JSON.parse(text) - }; - return result; - } - catch (error) { - throw new retry_1.RequestError(`${error}: ${text}`, response.status, response.retryCount); - } - case 302: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.status, response.retryCount); - case 400: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. ${(yield response.json()).alertMessages[0].header}`, response.status, response.retryCount); - case 401: - let authUrl = url.split('/api/')[0]; - authUrl += this.ci ? '/Administration.html#page=authToken' : '/UserSettings.html#page=authToken'; - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please provide a valid TICS authentication token. See ${authUrl}`, response.status, response.retryCount); - case 403: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Forbidden call: ${url}`, response.status, response.retryCount); - case 404: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}. Please check if the given ticsConfiguration is correct.`, response.status, response.retryCount); - default: - throw new retry_1.RequestError(`HTTP request failed with status ${response.status}: ${response.statusText}`, response.status, response.retryCount); - } - }); - } -} -exports["default"] = HttpClient; -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 9277: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RequestError = void 0; -exports.fetchBuilder = fetchBuilder; -class RequestError extends Error { - constructor(message, status, retryCount) { - super(message); - this.name = 'RequestError'; - this.status = status; - this.retryCount = retryCount; - } -} -exports.RequestError = RequestError; -function sanitize(params, defaults) { - const result = Object.assign(Object.assign({}, defaults), params); - if (typeof result.retries === 'undefined') { - result.retries = defaults.retries; - } - if (typeof result.retryDelay === 'undefined') { - result.retryDelay = defaults.retryDelay; - } - if (typeof result.retryOn === 'undefined') { - result.retryOn = defaults.retryOn; - } - return result; -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function fetchBuilder(fetchFunc, params = {}) { - const defaults = sanitize(params, { retries: 3, retryDelay: 500, retryOn: [419, 503, 504] }); - return function (input, init) { - const frp = sanitize({ - // TICS -no-unsafe-assignment - retries: init === null || init === void 0 ? void 0 : init.retries, - retryDelay: init === null || init === void 0 ? void 0 : init.retryDelay, - retryOn: init === null || init === void 0 ? void 0 : init.retryOn - // TICS +no-unsafe-assignment - }, defaults); - const retryDelayFn = typeof frp.retryDelay === 'function' ? frp.retryDelay : () => frp.retryDelay; - const retryOnFn = typeof frp.retryOn === 'function' - ? frp.retryOn - : (attempt, retries, error, response) => (!!error || !response || frp.retryOn.indexOf(response.status) !== -1) && attempt < retries; - return new Promise(function (resolve, reject) { - const extendedFetch = function (attempt) { - fetchFunc(input, init) - .then(function (response) { - if (retryOnFn(attempt, frp.retries, null, response)) { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - retry(attempt, null, response); - } - else { - const responseWithRetryCount = response; - responseWithRetryCount.retryCount = attempt; - resolve(responseWithRetryCount); - } - }) - .catch(function (error) { - if (retryOnFn(attempt, frp.retries, error, null)) { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - retry(attempt, error, null); - } - else { - reject(new RequestError(error.message, 0, attempt)); - } - }); - }; - function retry(attempt, error, response) { - setTimeout(function () { - extendedFetch(++attempt); - }, retryDelayFn(attempt, error, response)); - } - extendedFetch(0); - }); - }; -} -exports["default"] = fetchBuilder; -//# sourceMappingURL=retry.js.map - -/***/ }), - /***/ 75926: /***/ ((__unused_webpack_module, exports) => { @@ -170004,7 +169812,7 @@ exports.DEFAULT_RETRY_POLICY_COUNT = 3; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createPipelineFromOptions = createPipelineFromOptions; const logPolicy_js_1 = __nccwpck_require__(47129); -const pipeline_js_1 = __nccwpck_require__(22338); +const pipeline_js_1 = __nccwpck_require__(99957); const redirectPolicy_js_1 = __nccwpck_require__(92187); const userAgentPolicy_js_1 = __nccwpck_require__(91691); const decompressResponsePolicy_js_1 = __nccwpck_require__(35035); @@ -170192,7 +170000,7 @@ tslib_1.__exportStar(__nccwpck_require__(92097), exports); tslib_1.__exportStar(__nccwpck_require__(43097), exports); var pipelineRequest_js_1 = __nccwpck_require__(72305); Object.defineProperty(exports, "createPipelineRequest", ({ enumerable: true, get: function () { return pipelineRequest_js_1.createPipelineRequest; } })); -var pipeline_js_1 = __nccwpck_require__(22338); +var pipeline_js_1 = __nccwpck_require__(99957); Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } })); var restError_js_1 = __nccwpck_require__(9758); Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return restError_js_1.RestError; } })); @@ -170857,7 +170665,7 @@ function createNodeHttpClient() { /***/ }), -/***/ 22338: +/***/ 99957: /***/ ((__unused_webpack_module, exports) => { "use strict"; diff --git a/package-lock.json b/package-lock.json index 6abab576..56c62aa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@octokit/plugin-paginate-graphql": "^4.0.1", "@octokit/plugin-retry": "^6.1.0", "@octokit/request-error": "^5.1.1", - "@tiobe/http-client": "^0.4.0", + "@tiobe/http-client": "^0.5.0", "@tiobe/install-tics": "^0.6.0", "canonical-path": "^1.0.0", "date-fns": "^4.1.0", @@ -3187,12 +3187,12 @@ } }, "node_modules/@tiobe/http-client": { - "version": "0.4.0", - "resolved": "https://artifacts.tiobe.com/repository/npm/@tiobe/http-client/-/http-client-0.4.0.tgz", - "integrity": "sha512-9xs4BiRjIyWKkhLWncQrBryAtJKt+aM6j1D/uF/qovLOb6Tm5HvNBYGkBDo+RFc8xwagv//n07whSm5uRpBNOw==", + "version": "0.5.0", + "resolved": "https://artifacts.tiobe.com/repository/npm/@tiobe/http-client/-/http-client-0.5.0.tgz", + "integrity": "sha512-TT9e4NFvPDumOMwHoXFAWx5haGWL5a3rjoezRSXwr27L/DQUJLGSGx9BoWu/xwVtmwr4ebc8DnLLNZ0U6jVehw==", "license": "MIT", "dependencies": { - "@types/node-fetch": "^2.6.2", + "@types/node-fetch": "^2.6.11", "node-fetch": "2.7.0" } }, @@ -3205,16 +3205,6 @@ "@tiobe/http-client": "^0.5.0" } }, - "node_modules/@tiobe/install-tics/node_modules/@tiobe/http-client": { - "version": "0.5.0", - "resolved": "https://artifacts.tiobe.com/repository/npm/@tiobe/http-client/-/http-client-0.5.0.tgz", - "integrity": "sha512-TT9e4NFvPDumOMwHoXFAWx5haGWL5a3rjoezRSXwr27L/DQUJLGSGx9BoWu/xwVtmwr4ebc8DnLLNZ0U6jVehw==", - "license": "MIT", - "dependencies": { - "@types/node-fetch": "^2.6.11", - "node-fetch": "2.7.0" - } - }, "node_modules/@tootallnate/quickjs-emscripten": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", diff --git a/package.json b/package.json index 5f1b717a..7e3f1986 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@octokit/plugin-paginate-graphql": "^4.0.1", "@octokit/plugin-retry": "^6.1.0", "@octokit/request-error": "^5.1.1", - "@tiobe/http-client": "^0.4.0", + "@tiobe/http-client": "^0.5.0", "@tiobe/install-tics": "^0.6.0", "canonical-path": "^1.0.0", "date-fns": "^4.1.0", diff --git a/test/unit/helper/response.test.ts b/test/unit/helper/response.test.ts index 8ea6a2a8..f592a92a 100644 --- a/test/unit/helper/response.test.ts +++ b/test/unit/helper/response.test.ts @@ -50,13 +50,13 @@ describe('getRetryErrorMessage', () => { }); it('should return Error on RequestError of @tiobe/http-client with retry.', () => { - const message = getRetryErrorMessage(new TicsError('Error message here', 2)); + const message = getRetryErrorMessage(new TicsError('Error message here', 400, 2)); expect(message).toBe('Error message here (retried 2 times)'); }); it('should return Error on RequestError of @tiobe/http-client without retry.', () => { - const message = getRetryErrorMessage(new TicsError('Error message here', 0)); + const message = getRetryErrorMessage(new TicsError('Error message here', 400, 0)); expect(message).toBe('Error message here'); }); From 74e765daa42a386d09b50385915030b0ff48e86a Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Thu, 13 Nov 2025 10:29:13 +0100 Subject: [PATCH 20/22] #35162: Processed review requests --- README.md | 16 +++++++------- dist/index.js | 39 +++++++++++++++++++++++----------- src/action/decorate/action.ts | 8 +++---- src/action/decorate/summary.ts | 23 +++++++++++++++----- src/configuration/github.ts | 1 + src/github/annotations.ts | 11 +++++----- 6 files changed, 64 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index a3bd1a99..ad4ec37e 100644 --- a/README.md +++ b/README.md @@ -212,14 +212,14 @@ jobs: It is possible to retrieve all Quality Gate conditions and reported annotations in JSON format. To do this add an id to the step: ```yaml -- name: TICS GitHub Action - id: tics-github-action - uses: tiobe/tics-github-action@v3 - with: - mode: diagnostic - viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config - ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} - installTics: true + - name: TICS GitHub Action + id: tics-github-action + uses: tiobe/tics-github-action@v3 + with: + mode: diagnostic + viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config + ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} + installTics: true ``` This can then be used in following steps with `{{ steps.tics-github-action.outputs.annotations }}`. diff --git a/dist/index.js b/dist/index.js index ad5ec793..c11b462d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45,9 +45,6 @@ const annotations_1 = __nccwpck_require__(7624); * @param analysisResult */ async function decorateAction(analysisResult, analysis) { - if (analysisResult && config_1.actionConfig.postAnnotations) { - await (0, annotations_1.postAnnotations)(analysisResult.projectResults); - } let summaryBody; if (analysisResult) { summaryBody = await (0, summary_1.createSummaryBody)(analysisResult); @@ -58,6 +55,9 @@ async function decorateAction(analysisResult, analysis) { if (config_1.githubConfig.event.isPullRequest) { await (0, pull_request_1.decoratePullRequest)(analysisResult?.passed ?? false, summaryBody); } + if (analysisResult && config_1.actionConfig.postAnnotations) { + await (0, annotations_1.postAnnotations)(analysisResult.projectResults); + } } @@ -509,10 +509,23 @@ function createUnpostableAnnotationsDetails(unpostableAnnotations) { unpostableAnnotations.forEach(reviewComment => { const path = reviewComment.path; const displayCount = reviewComment.displayCount ?? ''; - const icon = reviewComment.blocking?.state === 'after' ? ':warning:' : ':x:'; - const blocking = reviewComment.blocking?.state === 'after' && reviewComment.blocking.after - ? `Blocking after ${(0, date_fns_1.format)(reviewComment.blocking.after, 'yyyy-MM-dd')}` - : 'Blocking'; + let icon = ''; + let blocking = ''; + switch (reviewComment.blocking?.state) { + case 'no': + icon = ':beetle:'; + blocking = 'Non-Blocking'; + break; + case 'after': + icon = ':warning:'; + blocking = `Blocking after${reviewComment.blocking.after ? `: ${(0, date_fns_1.format)(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; + break; + case 'yes': + default: + icon = ':x:'; + blocking = 'Blocking'; + break; + } if (previousPath === '') { body += ``; } @@ -1006,6 +1019,7 @@ class GithubConfig { apiUrl; owner; reponame; + // Sha of the (merge) commit sha; // Sha of the (underlying) commit that triggered the flow headSha; @@ -1468,6 +1482,7 @@ async function postAnnotations(projectResults) { logger_1.logger.warning('Commit of underlying commit not found, cannot post annotations'); return; } + const batchSize = 50; const annotations = projectResults .flatMap(projectResult => projectResult.annotations) .filter(shouldPostAnnotation) @@ -1477,14 +1492,14 @@ async function postAnnotations(projectResults) { return; } let checkRunId = 0; - for (let i = 0; i < annotations.length; i += 50) { + for (let i = 0; i < annotations.length; i += batchSize) { const params = { owner: config_1.githubConfig.owner, repo: config_1.githubConfig.reponame, output: { title: 'TICS annotations', summary: '', - annotations: annotations.slice(i, i + 50) + annotations: annotations.slice(i, i + batchSize) } }; try { @@ -1493,8 +1508,8 @@ async function postAnnotations(projectResults) { ...params, head_sha: config_1.githubConfig.headSha, name: 'TICS annotations', - conclusion: i + 50 >= annotations.length ? 'success' : undefined, - status: i + 50 >= annotations.length ? undefined : 'in_progress' + conclusion: i + batchSize >= annotations.length ? 'success' : undefined, + status: i + batchSize >= annotations.length ? undefined : 'in_progress' }; logger_1.logger.debug('Creating check run with: ' + JSON.stringify(pars)); const response = await octokit_1.octokit.rest.checks.create(pars); @@ -1502,7 +1517,7 @@ async function postAnnotations(projectResults) { } else { const pars = { ...params, check_run_id: checkRunId }; - if (i + 50 >= annotations.length) { + if (i + batchSize >= annotations.length) { pars.conclusion = 'success'; } logger_1.logger.debug('Updating check run with: ' + JSON.stringify(pars)); diff --git a/src/action/decorate/action.ts b/src/action/decorate/action.ts index b4df3f18..5ed67460 100644 --- a/src/action/decorate/action.ts +++ b/src/action/decorate/action.ts @@ -10,10 +10,6 @@ import { Analysis, AnalysisResult } from '../../helper/interfaces'; * @param analysisResult */ export async function decorateAction(analysisResult: AnalysisResult | undefined, analysis: Analysis): Promise { - if (analysisResult && actionConfig.postAnnotations) { - await postAnnotations(analysisResult.projectResults); - } - let summaryBody; if (analysisResult) { summaryBody = await createSummaryBody(analysisResult); @@ -24,4 +20,8 @@ export async function decorateAction(analysisResult: AnalysisResult | undefined, if (githubConfig.event.isPullRequest) { await decoratePullRequest(analysisResult?.passed ?? false, summaryBody); } + + if (analysisResult && actionConfig.postAnnotations) { + await postAnnotations(analysisResult.projectResults); + } } diff --git a/src/action/decorate/summary.ts b/src/action/decorate/summary.ts index f1f44947..49d4261a 100644 --- a/src/action/decorate/summary.ts +++ b/src/action/decorate/summary.ts @@ -330,11 +330,24 @@ export function createUnpostableAnnotationsDetails(unpostableAnnotations: Extend unpostableAnnotations.forEach(reviewComment => { const path = reviewComment.path; const displayCount = reviewComment.displayCount ?? ''; - const icon = reviewComment.blocking?.state === 'after' ? ':warning:' : ':x:'; - const blocking = - reviewComment.blocking?.state === 'after' && reviewComment.blocking.after - ? `Blocking after ${format(reviewComment.blocking.after, 'yyyy-MM-dd')}` - : 'Blocking'; + + let icon = ''; + let blocking = ''; + switch (reviewComment.blocking?.state) { + case 'no': + icon = ':beetle:'; + blocking = 'Non-Blocking'; + break; + case 'after': + icon = ':warning:'; + blocking = `Blocking after${reviewComment.blocking.after ? `: ${format(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; + break; + case 'yes': + default: + icon = ':x:'; + blocking = 'Blocking'; + break; + } if (previousPath === '') { body += `
${path}
`; diff --git a/src/configuration/github.ts b/src/configuration/github.ts index d53f0e0c..2b2c0044 100644 --- a/src/configuration/github.ts +++ b/src/configuration/github.ts @@ -7,6 +7,7 @@ export class GithubConfig { readonly apiUrl: string; readonly owner: string; readonly reponame: string; + // Sha of the (merge) commit readonly sha: string; // Sha of the (underlying) commit that triggered the flow readonly headSha: string | undefined; diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 793801bd..93ab0c3c 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -45,6 +45,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< return; } + const batchSize = 50; const annotations = projectResults .flatMap(projectResult => projectResult.annotations) .filter(shouldPostAnnotation) @@ -56,14 +57,14 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< } let checkRunId = 0; - for (let i = 0; i < annotations.length; i += 50) { + for (let i = 0; i < annotations.length; i += batchSize) { const params = { owner: githubConfig.owner, repo: githubConfig.reponame, output: { title: 'TICS annotations', summary: '', - annotations: annotations.slice(i, i + 50) + annotations: annotations.slice(i, i + batchSize) } }; @@ -73,15 +74,15 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< ...params, head_sha: githubConfig.headSha, name: 'TICS annotations', - conclusion: i + 50 >= annotations.length ? 'success' : undefined, - status: i + 50 >= annotations.length ? undefined : 'in_progress' + conclusion: i + batchSize >= annotations.length ? 'success' : undefined, + status: i + batchSize >= annotations.length ? undefined : 'in_progress' }; logger.debug('Creating check run with: ' + JSON.stringify(pars)); const response = await octokit.rest.checks.create(pars); checkRunId = response.data.id; } else { const pars: UpdateCheckRunParams = { ...params, check_run_id: checkRunId }; - if (i + 50 >= annotations.length) { + if (i + batchSize >= annotations.length) { pars.conclusion = 'success'; } logger.debug('Updating check run with: ' + JSON.stringify(pars)); From d8e6bba8935a12e1e61af867bc5d238321fc5244 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Thu, 13 Nov 2025 16:09:03 +0100 Subject: [PATCH 21/22] #35162: Replaced showNonBlocking with showAnnotationSeverity and deprecated showBlockingAfter --- README.md | 74 ++++++++++++---------- action.yaml | 8 +-- dist/index.js | 86 +++++++++++++++++--------- src/action/decorate/summary.ts | 2 +- src/configuration/action.ts | 57 +++++++++++++++-- src/github/annotations.ts | 14 +---- src/viewer/annotations.ts | 19 +----- test/.setup/mock.ts | 4 +- test/unit/configuration/action.test.ts | 50 ++++++++++++++- test/unit/github/annotations.test.ts | 75 ++++++++-------------- test/unit/viewer/annotations.test.ts | 4 +- 11 files changed, 237 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index ad4ec37e..28f2e4d1 100644 --- a/README.md +++ b/README.md @@ -81,20 +81,25 @@ The following inputs are recommended or required for this action: The following options allow to instrument TICS Client more specifically: -| Input | Description | Default | -| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------ | -| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. The `GATE` metric is supported for TICS Viewer versions higher than 2022.2.x. | `GATE` | -| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. The `GATE` GATE metric is supported for TICS Viewer versions higher than 2022.2.x. | - | -| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | -| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | -| `filelist` | Path to a file containing [a list of files](https://ticsdocumentation.tiobe.com/latest/docs/#doc=user/clientusecases.html%23client-file-list) (newline separated) to run TICS for. This can be an absolute or relative (to workspace) path, and can also be `.` to analyze the whole project. This has to be set when the action is run outside of a pull request. | - | -| `cdtoken` | A custom client-data token for the purpose of the Client Viewer functionality. This provides a static URL that is updated with every analysis. | - | -| `branchname` | Name of the branch in TICS. | - | -| `codetype` | Allows you to pick which specific types of code you want to analyze with the TICS client. Options are `PRODUCTION`, `TESTCODE`, `EXTERNAL` and `GENERATED`. | `PRODUCTION` | -| `excludeMovedFiles` | Exclude moved files from analysis even if there are modifications in the file. | `false` | -| `showBlockingAfter` | Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | -| `showNonBlocking` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | -| `tmpdir` | Location to store debug information. | - | +| Input | Description | Default | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------- | +| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. The `GATE` metric is supported for TICS Viewer versions higher than 2022.2.x. | `GATE` | +| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. The `GATE` GATE metric is supported for TICS Viewer versions higher than 2022.2.x. | - | +| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | +| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | +| `filelist` | Path to a file containing [a list of files](https://ticsdocumentation.tiobe.com/latest/docs/#doc=user/clientusecases.html%23client-file-list) (newline separated) to run TICS for. This can be an absolute or relative (to workspace) path, and can also be `.` to analyze the whole project. This has to be set when the action is run outside of a pull request. | - | +| `cdtoken` | A custom client-data token for the purpose of the Client Viewer functionality. This provides a static URL that is updated with every analysis. | - | +| `branchname` | Name of the branch in TICS. | - | +| `codetype` | Allows you to pick which specific types of code you want to analyze with the TICS client. Options are `PRODUCTION`, `TESTCODE`, `EXTERNAL` and `GENERATED`. | `PRODUCTION` | +| `excludeMovedFiles` | Exclude moved files from analysis even if there are modifications in the file. | `false` | +| `showAnnotationSeverity` | Show TICS violations with at least the specified severity in the changed files window (will also show up in `outputs.annotations`). Options are `blocking`, `blocking-after` or `issue`. | `blocking-after` | +| `tmpdir` | Location to store debug information. | - | + +#### Deprecated parameters + +| Input | Description | Default | Replacement | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------ | +| `showBlockingAfter` | !Will not be used if `showAnnotationSeverity` is set! Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | `showAnnotationSeverity` | ## QServer @@ -149,16 +154,21 @@ The following inputs are recommended or required for this action: The following options allow to instrument TICSQServer more specifically: -| Input | Description | Default | -| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | -| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. | `ALL` | -| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. | - | -| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | -| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | -| `branchname` | Name of the branch in TICS. | - | -| `showBlockingAfter` | Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | -| `showNonBlocking` | Include existing TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false`. | `false` | -| `tmpdir` | Location to store debug information. | - | +| Input | Description | Default | +| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | +| `calc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be calculated. | `ALL` | +| `recalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to be recalculated. | - | +| `nocalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be calculated. | - | +| `norecalc` | Comma-separated list of [metrics](https://ticsdocumentation.tiobe.com/latest/docs/index.html#doc=user/clientoptions.html%23MetricAliases) to not be recalculated. | - | +| `branchname` | Name of the branch in TICS. | - | +| `showAnnotationSeverity` | Show TICS violations with at least the specified severity in the changed files window (will also show up in `outputs.annotations`). Options are `blocking`, `blocking-after` or `issue`. | `blocking-after` | +| `tmpdir` | Location to store debug information. | - | + +#### Deprecated parameters + +| Input | Description | Default | Replacement | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------ | +| `showBlockingAfter` | !Will not be used if `showAnnotationSeverity` is set! Show the blocking after violations in the changed files window. Options are `true` or `false`. | `true` | `showAnnotationSeverity` | ## Other features @@ -212,14 +222,14 @@ jobs: It is possible to retrieve all Quality Gate conditions and reported annotations in JSON format. To do this add an id to the step: ```yaml - - name: TICS GitHub Action - id: tics-github-action - uses: tiobe/tics-github-action@v3 - with: - mode: diagnostic - viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config - ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} - installTics: true +- name: TICS GitHub Action + id: tics-github-action + uses: tiobe/tics-github-action@v3 + with: + mode: diagnostic + viewerUrl: https://domain.com/tiobeweb/TICS/api/cfg?name=config + ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} + installTics: true ``` This can then be used in following steps with `{{ steps.tics-github-action.outputs.annotations }}`. diff --git a/action.yaml b/action.yaml index e8953a93..8c9b28da 100644 --- a/action.yaml +++ b/action.yaml @@ -82,13 +82,13 @@ inputs: description: Comma-seperated list of extra secrets to mask in the console output. required: false showBlockingAfter: - description: Show the blocking after TICS violations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `true`). + description: (deprecated) !Will not be used if `showAnnotationSeverity` is set! Show the blocking after TICS violations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `true`). required: false default: true - showNonBlocking: - description: Show non-blocking TICS violations when posting annotations in the changed files window (will also show up in `outputs.annotations`). Options are `true` or `false` (default is `false`). + deprecationMessage: This input parameter is deprecated in favor of `showAnnotationSeverity`. + showAnnotationSeverity: + description: Show TICS violations with at least the specified severity in the changed files window (will also show up in `outputs.annotations`). Options are `blocking`, `blocking-after` or `issue` (default is `blocking-after`). required: false - default: false ticsAuthToken: description: Authentication token to authorize the plugin when it connects to the TICS Viewer. required: false diff --git a/dist/index.js b/dist/index.js index c11b462d..4b40b142 100644 --- a/dist/index.js +++ b/dist/index.js @@ -518,7 +518,7 @@ function createUnpostableAnnotationsDetails(unpostableAnnotations) { break; case 'after': icon = ':warning:'; - blocking = `Blocking after${reviewComment.blocking.after ? `: ${(0, date_fns_1.format)(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; + blocking = `Blocking after${reviewComment.blocking.after ? ` ${(0, date_fns_1.format)(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: @@ -887,10 +887,47 @@ async function getAnalysisResult(date) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ActionConfiguration = void 0; +exports.ActionConfiguration = exports.ShowAnnotationSeverity = void 0; const os_1 = __nccwpck_require__(70857); const core_1 = __nccwpck_require__(37484); const logger_1 = __nccwpck_require__(66113); +class ShowAnnotationSeverity { + param; + severities; + blockingStates; + static BLOCKING = new ShowAnnotationSeverity('blocking', ['blocking'], ['yes']); + static AFTER = new ShowAnnotationSeverity('blocking-after', ['blocking', 'after'], ['yes', 'after']); + static ISSUE = new ShowAnnotationSeverity('issue', ['blocking', 'after', 'issue'], ['yes', 'after', 'no']); + constructor(param, severities, blockingStates) { + this.param = param; + this.severities = severities; + this.blockingStates = blockingStates; + } + static parse(input) { + const severity = input.toLowerCase(); + switch (severity) { + case this.BLOCKING.param: + return this.BLOCKING; + case this.AFTER.param: + return this.AFTER; + case this.ISSUE.param: + return this.ISSUE; + } + throw Error(`Parameter 'showAnnotationSeverity' should be one of 'blocking', 'blocking-after' or 'issue'. Input given is '${input}'`); + } + getAnnotationSeverityFilter() { + if (this.severities.length > 1) { + return `AnnotationSeverity(Set(${this.severities.join(',')}))`; + } + else { + return `AnnotationSeverity(${this.severities[0]})`; + } + } + shouldPostAnnotation(annotation) { + return annotation.postable && (annotation.blocking?.state === undefined || this.blockingStates.includes(annotation.blocking.state)); + } +} +exports.ShowAnnotationSeverity = ShowAnnotationSeverity; class ActionConfiguration { excludeMovedFiles; postAnnotations; @@ -898,8 +935,7 @@ class ActionConfiguration { pullRequestApproval; retryConfig; secretsFilter; - showBlockingAfter; - showNonBlocking; + showAnnotationSeverity; constructor() { this.excludeMovedFiles = (0, core_1.getBooleanInput)('excludeMovedFiles'); this.postAnnotations = (0, core_1.getBooleanInput)('postAnnotations'); @@ -907,8 +943,7 @@ class ActionConfiguration { this.pullRequestApproval = (0, core_1.getBooleanInput)('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig((0, core_1.getInput)('retryCodes')); this.secretsFilter = this.getSecretsFilter((0, core_1.getInput)('secretsFilter')); - this.showBlockingAfter = (0, core_1.getBooleanInput)('showBlockingAfter'); - this.showNonBlocking = (0, core_1.getBooleanInput)('showNonBlocking'); + this.showAnnotationSeverity = this.getAnnotationSeverity((0, core_1.getInput)('showAnnotationSeverity'), (0, core_1.getBooleanInput)('showBlockingAfter')); } /** * Validates if the given input are valid retry codes and returns them. @@ -953,6 +988,19 @@ class ActionConfiguration { logger_1.logger.setSecretsFilter(combinedFilters); return combinedFilters; } + getAnnotationSeverity(input, blockingAfter) { + // `showAnnotationSeverity` takes precedent over `blockingAfter`, which is deprecated. + if (input !== '') { + return ShowAnnotationSeverity.parse(input); + } + else { + // if `showAnnotationSeverity` is not set use the value of `blockingAfter` to set a level. + if (!blockingAfter) { + return ShowAnnotationSeverity.BLOCKING; + } + return ShowAnnotationSeverity.AFTER; + } + } } exports.ActionConfiguration = ActionConfiguration; @@ -1485,7 +1533,7 @@ async function postAnnotations(projectResults) { const batchSize = 50; const annotations = projectResults .flatMap(projectResult => projectResult.annotations) - .filter(shouldPostAnnotation) + .filter(annotation => config_1.actionConfig.showAnnotationSeverity.shouldPostAnnotation(annotation)) .map(createGithubAnnotation); if (annotations.length === 0) { logger_1.logger.info('No annotations to post.'); @@ -1531,13 +1579,6 @@ async function postAnnotations(projectResults) { } logger_1.logger.info('Posted all postable annotations'); } -function shouldPostAnnotation(annotation) { - return (annotation.postable && - (annotation.blocking?.state === undefined || - annotation.blocking.state === 'yes' || - (annotation.blocking.state === 'after' && config_1.actionConfig.showBlockingAfter) || - (annotation.blocking.state === 'no' && config_1.actionConfig.showNonBlocking))); -} function createGithubAnnotation(annotation) { const title = annotation.msg; const body = createReviewCommentBody(annotation); @@ -1568,7 +1609,7 @@ function createReviewCommentBody(annotation) { body = 'Non-Blocking'; break; case 'after': - body = `Blocking after${annotation.blocking.after ? `: ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + body = `Blocking after${annotation.blocking.after ? ` ${(0, date_fns_1.format)(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: @@ -2861,11 +2902,7 @@ async function fetchAnnotationsWithApiLinks(apiLinks) { } async function fetchAnnotationsByRun(identifier) { const annotationsUrl = new URL(`${config_1.ticsConfig.baseUrl}/api/public/v1/Annotations?metric=QualityGate()`); - let filters = `Project(${identifier.project})`; - const annotationSeverity = getAnnotationSeverity(); - if (annotationSeverity) { - filters += `,${annotationSeverity}`; - } + let filters = `Project(${identifier.project}),${config_1.actionConfig.showAnnotationSeverity.getAnnotationSeverityFilter()}`; if (identifier.cdtoken) { filters += `,ClientData(${identifier.cdtoken})`; } @@ -2876,15 +2913,6 @@ async function fetchAnnotationsByRun(identifier) { annotationsUrl.searchParams.set('filters', filters); return fetchAnnotations(annotationsUrl); } -function getAnnotationSeverity() { - if (config_1.actionConfig.showNonBlocking) { - return undefined; - } - if (config_1.actionConfig.showBlockingAfter) { - return 'AnnotationSeverity(Set(blocking,after))'; - } - return 'AnnotationSeverity(blocking)'; -} async function fetchAnnotations(annotationsUrl, gateId) { const fields = annotationsUrl.searchParams.get('fields'); const requiredFields = 'default,ruleHelp,synopsis,ruleset,blocking'; diff --git a/src/action/decorate/summary.ts b/src/action/decorate/summary.ts index 49d4261a..68e3124c 100644 --- a/src/action/decorate/summary.ts +++ b/src/action/decorate/summary.ts @@ -340,7 +340,7 @@ export function createUnpostableAnnotationsDetails(unpostableAnnotations: Extend break; case 'after': icon = ':warning:'; - blocking = `Blocking after${reviewComment.blocking.after ? `: ${format(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; + blocking = `Blocking after${reviewComment.blocking.after ? ` ${format(reviewComment.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: diff --git a/src/configuration/action.ts b/src/configuration/action.ts index 6024130d..499fe6a7 100644 --- a/src/configuration/action.ts +++ b/src/configuration/action.ts @@ -3,6 +3,44 @@ import { getBooleanInput, getInput } from '@actions/core'; import { RetryConfig } from './interfaces'; import { logger } from '../helper/logger'; +import { ExtendedAnnotation } from '../viewer/interfaces'; + +export class ShowAnnotationSeverity { + static readonly BLOCKING = new ShowAnnotationSeverity('blocking', ['blocking'], ['yes']); + static readonly AFTER = new ShowAnnotationSeverity('blocking-after', ['blocking', 'after'], ['yes', 'after']); + static readonly ISSUE = new ShowAnnotationSeverity('issue', ['blocking', 'after', 'issue'], ['yes', 'after', 'no']); + + private constructor( + readonly param: string, + readonly severities: string[], + readonly blockingStates: string[] + ) {} + + static parse(input: string) { + const severity = input.toLowerCase(); + switch (severity) { + case this.BLOCKING.param: + return this.BLOCKING; + case this.AFTER.param: + return this.AFTER; + case this.ISSUE.param: + return this.ISSUE; + } + throw Error(`Parameter 'showAnnotationSeverity' should be one of 'blocking', 'blocking-after' or 'issue'. Input given is '${input}'`); + } + + getAnnotationSeverityFilter(): string { + if (this.severities.length > 1) { + return `AnnotationSeverity(Set(${this.severities.join(',')}))`; + } else { + return `AnnotationSeverity(${this.severities[0]})`; + } + } + + shouldPostAnnotation(annotation: ExtendedAnnotation) { + return annotation.postable && (annotation.blocking?.state === undefined || this.blockingStates.includes(annotation.blocking.state)); + } +} export class ActionConfiguration { readonly excludeMovedFiles: boolean; @@ -11,8 +49,7 @@ export class ActionConfiguration { readonly pullRequestApproval: boolean; readonly retryConfig: RetryConfig; readonly secretsFilter: string[]; - readonly showBlockingAfter: boolean; - readonly showNonBlocking: boolean; + readonly showAnnotationSeverity: ShowAnnotationSeverity; constructor() { this.excludeMovedFiles = getBooleanInput('excludeMovedFiles'); @@ -21,8 +58,7 @@ export class ActionConfiguration { this.pullRequestApproval = getBooleanInput('pullRequestApproval'); this.retryConfig = this.validateAndGetRetryConfig(getInput('retryCodes')); this.secretsFilter = this.getSecretsFilter(getInput('secretsFilter')); - this.showBlockingAfter = getBooleanInput('showBlockingAfter'); - this.showNonBlocking = getBooleanInput('showNonBlocking'); + this.showAnnotationSeverity = this.getAnnotationSeverity(getInput('showAnnotationSeverity'), getBooleanInput('showBlockingAfter')); } /** @@ -72,4 +108,17 @@ export class ActionConfiguration { return combinedFilters; } + + private getAnnotationSeverity(input: string, blockingAfter: boolean): ShowAnnotationSeverity { + // `showAnnotationSeverity` takes precedent over `blockingAfter`, which is deprecated. + if (input !== '') { + return ShowAnnotationSeverity.parse(input); + } else { + // if `showAnnotationSeverity` is not set use the value of `blockingAfter` to set a level. + if (!blockingAfter) { + return ShowAnnotationSeverity.BLOCKING; + } + return ShowAnnotationSeverity.AFTER; + } + } } diff --git a/src/github/annotations.ts b/src/github/annotations.ts index 93ab0c3c..1c7a7f15 100644 --- a/src/github/annotations.ts +++ b/src/github/annotations.ts @@ -48,7 +48,7 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< const batchSize = 50; const annotations = projectResults .flatMap(projectResult => projectResult.annotations) - .filter(shouldPostAnnotation) + .filter(annotation => actionConfig.showAnnotationSeverity.shouldPostAnnotation(annotation)) .map(createGithubAnnotation); if (annotations.length === 0) { @@ -97,16 +97,6 @@ export async function postAnnotations(projectResults: ProjectResult[]): Promise< logger.info('Posted all postable annotations'); } -function shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { - return ( - annotation.postable && - (annotation.blocking?.state === undefined || - annotation.blocking.state === 'yes' || - (annotation.blocking.state === 'after' && actionConfig.showBlockingAfter) || - (annotation.blocking.state === 'no' && actionConfig.showNonBlocking)) - ); -} - function createGithubAnnotation(annotation: ExtendedAnnotation): GithubAnnotation { const title = annotation.msg; const body = createReviewCommentBody(annotation); @@ -140,7 +130,7 @@ function createReviewCommentBody(annotation: ExtendedAnnotation): string { body = 'Non-Blocking'; break; case 'after': - body = `Blocking after${annotation.blocking.after ? `: ${format(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; + body = `Blocking after${annotation.blocking.after ? ` ${format(annotation.blocking.after, 'yyyy-MM-dd')}` : ''}`; break; case 'yes': default: diff --git a/src/viewer/annotations.ts b/src/viewer/annotations.ts index ab5129c2..12321fa3 100644 --- a/src/viewer/annotations.ts +++ b/src/viewer/annotations.ts @@ -58,12 +58,7 @@ async function fetchAnnotationsWithApiLinks(apiLinks: AnnotationApiLink[]): Prom async function fetchAnnotationsByRun(identifier: TicsRunIdentifier): Promise { const annotationsUrl = new URL(`${ticsConfig.baseUrl}/api/public/v1/Annotations?metric=QualityGate()`); - let filters = `Project(${identifier.project})`; - - const annotationSeverity = getAnnotationSeverity(); - if (annotationSeverity) { - filters += `,${annotationSeverity}`; - } + let filters = `Project(${identifier.project}),${actionConfig.showAnnotationSeverity.getAnnotationSeverityFilter()}`; if (identifier.cdtoken) { filters += `,ClientData(${identifier.cdtoken})`; } else if (identifier.date) { @@ -75,18 +70,6 @@ async function fetchAnnotationsByRun(identifier: TicsRunIdentifier): Promise { const fields = annotationsUrl.searchParams.get('fields'); const requiredFields = 'default,ruleHelp,synopsis,ruleset,blocking'; diff --git a/test/.setup/mock.ts b/test/.setup/mock.ts index 4f64b8bf..b21a83c0 100644 --- a/test/.setup/mock.ts +++ b/test/.setup/mock.ts @@ -1,6 +1,7 @@ import { jest } from '@jest/globals'; import { summary } from './summary_mock'; import { GithubEvent } from '../../src/configuration/github-event'; +import { ShowAnnotationSeverity } from '../../src/configuration/action'; export const githubConfigMock: { apiUrl: string; @@ -64,8 +65,7 @@ export const actionConfigMock = { postAnnotations: false, postToConversation: false, pullRequestApproval: false, - showBlockingAfter: false, - showNonBlocking: false + showAnnotationSeverity: ShowAnnotationSeverity.AFTER }; export const ticsCliMock = { diff --git a/test/unit/configuration/action.test.ts b/test/unit/configuration/action.test.ts index 5a94e459..8ce5869e 100644 --- a/test/unit/configuration/action.test.ts +++ b/test/unit/configuration/action.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'; import * as core from '@actions/core'; -import { ActionConfiguration } from '../../../src/configuration/action'; +import { ActionConfiguration, ShowAnnotationSeverity } from '../../../src/configuration/action'; describe('action Configuration', () => { let values: Record; @@ -12,7 +12,7 @@ describe('action Configuration', () => { pullRequestApproval: false, retryConfig: { delay: 5, maxRetries: 10, codes: [419, 500, 501, 502, 503, 504] }, secretsFilter: ['TICSAUTHTOKEN', 'GITHUB_TOKEN', 'Authentication token', 'Authorization'], - showBlockingAfter: false + showAnnotationSeverity: ShowAnnotationSeverity.BLOCKING // because getBooleanInput returns false by default }; beforeEach(() => { @@ -69,7 +69,7 @@ describe('action Configuration', () => { pullRequestApproval: true, retryConfig: { delay: 5, maxRetries: 10, codes: [401] }, secretsFilter: ['TICSAUTHTOKEN', 'GITHUB_TOKEN', 'Authentication token', 'Authorization', 'additional', 'secrets'], - showBlockingAfter: true + showAnnotationSeverity: ShowAnnotationSeverity.AFTER }); }); @@ -161,4 +161,48 @@ describe('action Configuration', () => { expect(error.message).toContain("'500;502'"); }); }); + + describe('showAnnotationSeverity', () => { + it('should prefer showAnnotationSeverity over showBlockingAfter', () => { + values = { showBlockingAfter: 'false', showAnnotationSeverity: 'issue' }; + const config1 = new ActionConfiguration(); + expect(config1).toMatchObject({ ...expectDefault, showAnnotationSeverity: ShowAnnotationSeverity.ISSUE }); + + values = { showBlockingAfter: 'false', showAnnotationSeverity: 'blocking-after' }; + const config2 = new ActionConfiguration(); + expect(config2).toMatchObject({ ...expectDefault, showAnnotationSeverity: ShowAnnotationSeverity.AFTER }); + + values = { showBlockingAfter: 'false', showAnnotationSeverity: 'blocking' }; + const config3 = new ActionConfiguration(); + expect(config3).toMatchObject({ ...expectDefault, showAnnotationSeverity: ShowAnnotationSeverity.BLOCKING }); + }); + + it('should use showBlockingAfter if showAnnotationSeverity is not set', () => { + values = { showBlockingAfter: 'false' }; + const config1 = new ActionConfiguration(); + expect(config1).toMatchObject({ ...expectDefault }); + + values = { showBlockingAfter: 'true' }; + const config2 = new ActionConfiguration(); + expect(config2).toMatchObject({ ...expectDefault, showAnnotationSeverity: ShowAnnotationSeverity.AFTER }); + }); + + it('should throw Error when showAnnotationSeverity is incorrect', () => { + values = { + showAnnotationSeverity: 'bladiebla' + }; + + let error: any; + try { + new ActionConfiguration(); + } catch (err) { + error = err; + } + + expect(error).toBeInstanceOf(Error); + expect(error.message).toEqual( + "Parameter 'showAnnotationSeverity' should be one of 'blocking', 'blocking-after' or 'issue'. Input given is 'bladiebla'" + ); + }); + }); }); diff --git a/test/unit/github/annotations.test.ts b/test/unit/github/annotations.test.ts index 6edfe54d..141a2b68 100644 --- a/test/unit/github/annotations.test.ts +++ b/test/unit/github/annotations.test.ts @@ -13,6 +13,7 @@ import { octokit } from '../../../src/github/octokit'; import { actionConfigMock, githubConfigMock } from '../../.setup/mock'; import { EOL } from 'os'; import { SpiedFunction } from 'jest-mock'; +import { ShowAnnotationSeverity } from '../../../src/configuration/action'; describe('getPostedReviewComments', () => { it('should throw error when a pullRequestNumber is not present', async () => { @@ -138,8 +139,8 @@ describe('postAnnotations', () => { expect(infoSpy).toHaveBeenCalledWith('No annotations to post.'); }); - it('should post two annotations when showBlockingAfter is true', async () => { - actionConfigMock.showBlockingAfter = true; + it('should post two annotations when showAnnotationSeverity is AFTER', async () => { + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.AFTER; await postAnnotations(twoMixedAnalysisResults.projectResults); @@ -161,7 +162,7 @@ describe('postAnnotations', () => { { annotation_level: 'notice', end_line: 1, - message: `Blocking after: 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, + message: `Blocking after 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, path: 'path1.js', start_line: 1, title: 'message 1' @@ -177,8 +178,8 @@ describe('postAnnotations', () => { expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post four annotations when showBlockingAfter is true', async () => { - actionConfigMock.showBlockingAfter = true; + it('should post four annotations when showAnnotationSeverity is AFTER', async () => { + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.AFTER; await postAnnotations(fourMixedAnalysisResults.projectResults); @@ -200,7 +201,7 @@ describe('postAnnotations', () => { { annotation_level: 'notice', end_line: 1, - message: `Blocking after: 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, + message: `Blocking after 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, path: 'path1.js', start_line: 1, title: 'message 1' @@ -232,8 +233,8 @@ describe('postAnnotations', () => { expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post only a blocking annotation when showBlockingAfter is false', async () => { - actionConfigMock.showBlockingAfter = false; + it('should post only one blocking annotation when showAnnotationSeverity is BLOCKING', async () => { + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.BLOCKING; await postAnnotations(twoMixedAnalysisResults.projectResults); @@ -264,9 +265,8 @@ describe('postAnnotations', () => { expect(updateCheckSpy).toHaveBeenCalledTimes(0); }); - it('should post only two annotations when showBlockingAfter and showNonBlocking are false', async () => { - actionConfigMock.showBlockingAfter = false; - actionConfigMock.showNonBlocking = false; + it('should post five annotations when showAnnotationSeverity is ISSUE', async () => { + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.ISSUE; await postAnnotations(fiveMixedAnalysisResults.projectResults); @@ -286,45 +286,12 @@ describe('postAnnotations', () => { title: 'message 0' }, { - annotation_level: 'warning', - end_line: 2, - message: `Blocking${EOL}Level: 2, Category: category 2${EOL}Line: 2, Rule: rule 2`, - path: 'path2.js', - start_line: 2, - title: 'message 2' - } - ], - summary: '', - title: 'TICS annotations' - }, - owner: 'tester', - repo: 'test', - status: undefined - }); - - expect(updateCheckSpy).toHaveBeenCalledTimes(0); - }); - - it('should post three annotations when showBlockingAfter is false and showNonBlocking is true', async () => { - actionConfigMock.showBlockingAfter = false; - actionConfigMock.showNonBlocking = true; - - await postAnnotations(fiveMixedAnalysisResults.projectResults); - - expect(createCheckSpy).toHaveBeenCalledTimes(1); - expect(createCheckSpy).toHaveBeenCalledWith({ - conclusion: 'success', - head_sha: 'head-sha-256', - name: 'TICS annotations', - output: { - annotations: [ - { - annotation_level: 'warning', - end_line: 0, - message: `Blocking${EOL}Line: 0`, - path: 'path0.js', - start_line: 0, - title: 'message 0' + annotation_level: 'notice', + end_line: 1, + message: `Blocking after 1970-01-21${EOL}Level: 2, Category: category 1${EOL}Line: 1, Rule: rule 1`, + path: 'path1.js', + start_line: 1, + title: 'message 1' }, { annotation_level: 'warning', @@ -334,6 +301,14 @@ describe('postAnnotations', () => { start_line: 2, title: 'message 2' }, + { + annotation_level: 'notice', + end_line: 3, + message: `Blocking after${EOL}Level: 2, Category: category 3${EOL}Line: 3, Rule: rule 3${EOL}synopsis 3${EOL}Rule-help: https://ruleset/rule+3`, + path: 'path3.js', + start_line: 3, + title: 'message 3' + }, { annotation_level: 'notice', end_line: 2, diff --git a/test/unit/viewer/annotations.test.ts b/test/unit/viewer/annotations.test.ts index 6183a39c..1a82b4f4 100644 --- a/test/unit/viewer/annotations.test.ts +++ b/test/unit/viewer/annotations.test.ts @@ -7,6 +7,7 @@ import { GithubEvent } from '../../../src/configuration/github-event'; import { fetchAllAnnotations, groupAndExtendAnnotations } from '../../../src/viewer/annotations'; import { TicsRunIdentifier } from '../../../src/viewer/interfaces'; import { ViewerFeature, viewerVersion } from '../../../src/viewer/version'; +import { ShowAnnotationSeverity } from '../../../src/configuration/action'; describe('fetchAllAnnotations', () => { let httpClientSpy: jest.SpiedFunction; @@ -153,6 +154,7 @@ describe('fetchAllAnnotations', () => { }); identifier.cdtoken = 'test'; + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.BLOCKING; const response = await fetchAllAnnotations(qualityGate, identifier); expect(httpClientSpy).toHaveBeenCalledWith( @@ -177,7 +179,7 @@ describe('fetchAllAnnotations', () => { }); identifier.date = 15984835158; - actionConfigMock.showBlockingAfter = true; + actionConfigMock.showAnnotationSeverity = ShowAnnotationSeverity.AFTER; const response = await fetchAllAnnotations(qualityGate, identifier); expect(httpClientSpy).toHaveBeenCalledWith( From 4629b7e2483284aedfba8909f2d9474403887107 Mon Sep 17 00:00:00 2001 From: janssen <118828444+janssen-tiobe@users.noreply.github.com> Date: Thu, 13 Nov 2025 16:39:52 +0100 Subject: [PATCH 22/22] #35162: Fixed blocking issues --- src/configuration/action.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/configuration/action.ts b/src/configuration/action.ts index 499fe6a7..e48f783d 100644 --- a/src/configuration/action.ts +++ b/src/configuration/action.ts @@ -16,7 +16,7 @@ export class ShowAnnotationSeverity { readonly blockingStates: string[] ) {} - static parse(input: string) { + static parse(input: string): ShowAnnotationSeverity { const severity = input.toLowerCase(); switch (severity) { case this.BLOCKING.param: @@ -37,7 +37,7 @@ export class ShowAnnotationSeverity { } } - shouldPostAnnotation(annotation: ExtendedAnnotation) { + shouldPostAnnotation(annotation: ExtendedAnnotation): boolean { return annotation.postable && (annotation.blocking?.state === undefined || this.blockingStates.includes(annotation.blocking.state)); } }
${path}