fix linter and run package

This commit is contained in:
Connor 2024-03-01 10:29:58 -06:00
parent dd2ae7c835
commit 39cc308650
No known key found for this signature in database
GPG key ID: 455C6C81CB2BD091
2 changed files with 320 additions and 187 deletions

506
dist/index.js generated vendored
View file

@ -284,6 +284,7 @@ function main() {
}
class TestReporter {
constructor() {
this.maxAnnotationsPerBatch = 50;
this.artifact = core.getInput('artifact', { required: false });
this.name = core.getInput('name', { required: true });
this.path = core.getInput('path', { required: true });
@ -296,18 +297,35 @@ class TestReporter {
this.failOnEmpty = core.getInput('fail-on-empty', { required: true }) === 'true';
this.workDirInput = core.getInput('working-directory', { required: false });
this.onlySummary = core.getInput('only-summary', { required: false }) === 'true';
this.showHTMLNotice = core.getInput('show-html-notice', { required: false }) === 'true';
this.token = core.getInput('token', { required: true });
this.context = (0, github_utils_1.getCheckRunContext)();
this.handleAnnotations = (annotations, requestParams) => __awaiter(this, void 0, void 0, function* () {
const leftAnnotations = [...annotations];
let response;
do {
const toProcess = leftAnnotations.splice(0, 50);
const status = leftAnnotations.length > 0 ? 'in_progress' : 'completed';
response = yield this.updateAnnotation(toProcess, Object.assign(Object.assign({}, requestParams), { status }));
} while (leftAnnotations.length > 0);
return response;
});
this.updateAnnotation = (annotations, requestParams) => __awaiter(this, void 0, void 0, function* () {
return yield this.octokit.rest.checks.update(Object.assign(Object.assign({}, requestParams), { output: Object.assign(Object.assign({}, requestParams.output), { annotations }) }));
});
this.octokit = github.getOctokit(this.token);
if (this.listSuites !== 'all' && this.listSuites !== 'failed') {
core.setFailed(`Input parameter 'list-suites' has invalid value`);
core.setFailed(`Input parameter 'list-suites' has invalid value of ${this.listSuites}`);
return;
}
if (this.listTests !== 'all' && this.listTests !== 'failed' && this.listTests !== 'none') {
if (this.listTests !== 'all' &&
this.listTests !== 'failed' &&
this.listTests !== 'none' &&
this.listTests !== 'non-skipped') {
core.setFailed(`Input parameter 'list-tests' has invalid value`);
return;
}
if (isNaN(this.maxAnnotations) || this.maxAnnotations < 0 || this.maxAnnotations > 50) {
if (isNaN(this.maxAnnotations) || this.maxAnnotations > 50) {
core.setFailed(`Input parameter 'max-annotations' has invalid value`);
return;
}
@ -339,12 +357,16 @@ class TestReporter {
core.info(`Using test report parser '${this.reporter}'`);
const parser = this.getParser(this.reporter, options);
const results = [];
const outputHtml = [];
const input = yield inputProvider.load();
for (const [reportName, files] of Object.entries(input)) {
try {
core.startGroup(`Creating test report ${reportName}`);
const tr = yield this.createReport(parser, reportName, files);
const [tr, html] = yield this.createReport(parser, reportName, files);
results.push(...tr);
if (html != null) {
outputHtml.push(html);
}
}
finally {
core.endGroup();
@ -356,11 +378,13 @@ class TestReporter {
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
const time = results.reduce((sum, tr) => sum + tr.time, 0);
const html = [...new Set(outputHtml)].join(',');
core.setOutput('conclusion', conclusion);
core.setOutput('passed', passed);
core.setOutput('failed', failed);
core.setOutput('skipped', skipped);
core.setOutput('time', time);
core.setOutput('runHtmlUrl', html);
if (this.failOnError && isFailed) {
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`);
return;
@ -375,7 +399,7 @@ class TestReporter {
return __awaiter(this, void 0, void 0, function* () {
if (files.length === 0) {
core.warning(`No file matches path ${this.path}`);
return [];
return [[], ''];
}
core.info(`Processing test results for check run ${name}`);
const results = [];
@ -407,7 +431,7 @@ class TestReporter {
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
const shortSummary = `${passed} passed, ${failed} failed and ${skipped} skipped `;
core.info(`Updating check run conclusion (${conclusion}) and output`);
const resp = yield this.octokit.rest.checks.update(Object.assign({ check_run_id: createResp.data.id, conclusion, status: 'completed', output: {
const resp = yield this.handleAnnotations(annotations, Object.assign({ check_run_id: createResp.data.id, conclusion, status: 'completed', output: {
title: shortSummary,
summary,
annotations
@ -415,9 +439,15 @@ class TestReporter {
core.info(`Check run create response: ${resp.status}`);
core.info(`Check run URL: ${resp.data.url}`);
core.info(`Check run HTML: ${resp.data.html_url}`);
if (this.showHTMLNotice) {
core.info('*** showhtmlnotice set to true');
core.exportVariable('TEST_RESULTS_URL', `${resp.data.html_url}`);
core.info(`Set env var to: ${process.env.TEST_RESULTS_URL}`);
core.info(`::notice title=Test Results::${resp.data.html_url}`);
}
core.setOutput('url', resp.data.url);
core.setOutput('url_html', resp.data.html_url);
return results;
return [results, resp.data.html_url];
});
}
getParser(reporter, options) {
@ -1726,6 +1756,9 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
}
const space = grp.name ? ' ' : '';
for (const tc of grp.tests) {
if (options.listTests === 'non-skipped' && tc.result === 'skipped') {
continue;
}
const result = getResultIcon(tc.result);
sections.push(`${space}${result} ${tc.name}`);
if (tc.error) {
@ -5160,17 +5193,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
const fs = __importStar(__nccwpck_require__(7147));
const path = __importStar(__nccwpck_require__(1017));
_a = fs.promises
// export const {open} = 'fs'
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
// export const {open} = 'fs'
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
exports.IS_WINDOWS = process.platform === 'win32';
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
exports.UV_FS_O_EXLOCK = 0x10000000;
exports.READONLY = fs.constants.O_RDONLY;
function exists(fsPath) {
return __awaiter(this, void 0, void 0, function* () {
try {
@ -5351,8 +5378,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
const assert_1 = __nccwpck_require__(9491);
const childProcess = __importStar(__nccwpck_require__(2081));
const path = __importStar(__nccwpck_require__(1017));
const util_1 = __nccwpck_require__(3837);
const ioUtil = __importStar(__nccwpck_require__(1962));
const exec = util_1.promisify(childProcess.exec);
const execFile = util_1.promisify(childProcess.execFile);
/**
* Copies a file or folder.
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@ -5433,23 +5464,61 @@ exports.mv = mv;
function rmRF(inputPath) {
return __awaiter(this, void 0, void 0, function* () {
if (ioUtil.IS_WINDOWS) {
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
// Check for invalid characters
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
if (/[*"<>|]/.test(inputPath)) {
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
}
try {
const cmdPath = ioUtil.getCmdPath();
if (yield ioUtil.isDirectory(inputPath, true)) {
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
env: { inputPath }
});
}
else {
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
env: { inputPath }
});
}
}
catch (err) {
// if you try to delete a file that doesn't exist, desired result is achieved
// other errors are valid
if (err.code !== 'ENOENT')
throw err;
}
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
try {
yield ioUtil.unlink(inputPath);
}
catch (err) {
// if you try to delete a file that doesn't exist, desired result is achieved
// other errors are valid
if (err.code !== 'ENOENT')
throw err;
}
}
try {
// note if path does not exist, error is silent
yield ioUtil.rm(inputPath, {
force: true,
maxRetries: 3,
recursive: true,
retryDelay: 300
});
}
catch (err) {
throw new Error(`File was unable to be removed ${err}`);
else {
let isDir = false;
try {
isDir = yield ioUtil.isDirectory(inputPath);
}
catch (err) {
// if you try to delete a file that doesn't exist, desired result is achieved
// other errors are valid
if (err.code !== 'ENOENT')
throw err;
return;
}
if (isDir) {
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
}
else {
yield ioUtil.unlink(inputPath);
}
}
});
}
@ -6661,7 +6730,7 @@ var import_graphql = __nccwpck_require__(8467);
var import_auth_token = __nccwpck_require__(334);
// pkg/dist-src/version.js
var VERSION = "5.0.2";
var VERSION = "5.1.0";
// pkg/dist-src/index.js
var noop = () => {
@ -7370,7 +7439,7 @@ __export(dist_src_exports, {
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/version.js
var VERSION = "9.1.5";
var VERSION = "9.2.0";
// pkg/dist-src/normalize-paginated-list-response.js
function normalizePaginatedListResponse(response) {
@ -7531,6 +7600,8 @@ var paginatingEndpoints = [
"GET /orgs/{org}/members/{username}/codespaces",
"GET /orgs/{org}/migrations",
"GET /orgs/{org}/migrations/{migration_id}/repositories",
"GET /orgs/{org}/organization-roles/{role_id}/teams",
"GET /orgs/{org}/organization-roles/{role_id}/users",
"GET /orgs/{org}/outside_collaborators",
"GET /orgs/{org}/packages",
"GET /orgs/{org}/packages/{package_type}/{package_name}/versions",
@ -7767,7 +7838,7 @@ __export(dist_src_exports, {
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/version.js
var VERSION = "10.2.0";
var VERSION = "10.4.0";
// pkg/dist-src/generated/endpoints.js
var Endpoints = {
@ -7894,6 +7965,9 @@ var Endpoints = {
"GET /repos/{owner}/{repo}/actions/permissions/selected-actions"
],
getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"],
getCustomOidcSubClaimForRepo: [
"GET /repos/{owner}/{repo}/actions/oidc/customization/sub"
],
getEnvironmentPublicKey: [
"GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key"
],
@ -8046,6 +8120,9 @@ var Endpoints = {
setCustomLabelsForSelfHostedRunnerForRepo: [
"PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels"
],
setCustomOidcSubClaimForRepo: [
"PUT /repos/{owner}/{repo}/actions/oidc/customization/sub"
],
setGithubActionsDefaultWorkflowPermissionsOrganization: [
"PUT /orgs/{org}/actions/permissions/workflow"
],
@ -8115,6 +8192,7 @@ var Endpoints = {
listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"],
markNotificationsAsRead: ["PUT /notifications"],
markRepoNotificationsAsRead: ["PUT /repos/{owner}/{repo}/notifications"],
markThreadAsDone: ["DELETE /notifications/threads/{thread_id}"],
markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"],
setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"],
setThreadSubscription: [
@ -8391,10 +8469,10 @@ var Endpoints = {
updateForAuthenticatedUser: ["PATCH /user/codespaces/{codespace_name}"]
},
copilot: {
addCopilotForBusinessSeatsForTeams: [
addCopilotSeatsForTeams: [
"POST /orgs/{org}/copilot/billing/selected_teams"
],
addCopilotForBusinessSeatsForUsers: [
addCopilotSeatsForUsers: [
"POST /orgs/{org}/copilot/billing/selected_users"
],
cancelCopilotSeatAssignmentForTeams: [
@ -8707,10 +8785,24 @@ var Endpoints = {
}
]
},
oidc: {
getOidcCustomSubTemplateForOrg: [
"GET /orgs/{org}/actions/oidc/customization/sub"
],
updateOidcCustomSubTemplateForOrg: [
"PUT /orgs/{org}/actions/oidc/customization/sub"
]
},
orgs: {
addSecurityManagerTeam: [
"PUT /orgs/{org}/security-managers/teams/{team_slug}"
],
assignTeamToOrgRole: [
"PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
],
assignUserToOrgRole: [
"PUT /orgs/{org}/organization-roles/users/{username}/{role_id}"
],
blockUser: ["PUT /orgs/{org}/blocks/{username}"],
cancelInvitation: ["DELETE /orgs/{org}/invitations/{invitation_id}"],
checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"],
@ -8719,6 +8811,7 @@ var Endpoints = {
convertMemberToOutsideCollaborator: [
"PUT /orgs/{org}/outside_collaborators/{username}"
],
createCustomOrganizationRole: ["POST /orgs/{org}/organization-roles"],
createInvitation: ["POST /orgs/{org}/invitations"],
createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"],
createOrUpdateCustomPropertiesValuesForRepos: [
@ -8729,6 +8822,9 @@ var Endpoints = {
],
createWebhook: ["POST /orgs/{org}/hooks"],
delete: ["DELETE /orgs/{org}"],
deleteCustomOrganizationRole: [
"DELETE /orgs/{org}/organization-roles/{role_id}"
],
deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
enableOrDisableSecurityProductOnAllOrgRepos: [
"POST /orgs/{org}/{security_product}/{enablement}"
@ -8740,6 +8836,7 @@ var Endpoints = {
],
getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
getWebhookDelivery: [
@ -8755,6 +8852,12 @@ var Endpoints = {
listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
listMembers: ["GET /orgs/{org}/members"],
listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
listOrgRoleUsers: ["GET /orgs/{org}/organization-roles/{role_id}/users"],
listOrgRoles: ["GET /orgs/{org}/organization-roles"],
listOrganizationFineGrainedPermissions: [
"GET /orgs/{org}/organization-fine-grained-permissions"
],
listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"],
listPatGrantRepositories: [
"GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories"
@ -8769,6 +8872,9 @@ var Endpoints = {
listSecurityManagerTeams: ["GET /orgs/{org}/security-managers"],
listWebhookDeliveries: ["GET /orgs/{org}/hooks/{hook_id}/deliveries"],
listWebhooks: ["GET /orgs/{org}/hooks"],
patchCustomOrganizationRole: [
"PATCH /orgs/{org}/organization-roles/{role_id}"
],
pingWebhook: ["POST /orgs/{org}/hooks/{hook_id}/pings"],
redeliverWebhookDelivery: [
"POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts"
@ -8793,6 +8899,18 @@ var Endpoints = {
reviewPatGrantRequestsInBulk: [
"POST /orgs/{org}/personal-access-token-requests"
],
revokeAllOrgRolesTeam: [
"DELETE /orgs/{org}/organization-roles/teams/{team_slug}"
],
revokeAllOrgRolesUser: [
"DELETE /orgs/{org}/organization-roles/users/{username}"
],
revokeOrgRoleTeam: [
"DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}"
],
revokeOrgRoleUser: [
"DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}"
],
setMembershipForUser: ["PUT /orgs/{org}/memberships/{username}"],
setPublicMembershipForAuthenticatedUser: [
"PUT /orgs/{org}/public_members/{username}"
@ -9083,6 +9201,9 @@ var Endpoints = {
{},
{ mapToData: "users" }
],
cancelPagesDeployment: [
"POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel"
],
checkAutomatedSecurityFixes: [
"GET /repos/{owner}/{repo}/automated-security-fixes"
],
@ -9118,12 +9239,15 @@ var Endpoints = {
createForAuthenticatedUser: ["POST /user/repos"],
createFork: ["POST /repos/{owner}/{repo}/forks"],
createInOrg: ["POST /orgs/{org}/repos"],
createOrUpdateCustomPropertiesValues: [
"PATCH /repos/{owner}/{repo}/properties/values"
],
createOrUpdateEnvironment: [
"PUT /repos/{owner}/{repo}/environments/{environment_name}"
],
createOrUpdateFileContents: ["PUT /repos/{owner}/{repo}/contents/{path}"],
createOrgRuleset: ["POST /orgs/{org}/rulesets"],
createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployment"],
createPagesDeployment: ["POST /repos/{owner}/{repo}/pages/deployments"],
createPagesSite: ["POST /repos/{owner}/{repo}/pages"],
createRelease: ["POST /repos/{owner}/{repo}/releases"],
createRepoRuleset: ["POST /repos/{owner}/{repo}/rulesets"],
@ -9276,6 +9400,9 @@ var Endpoints = {
getOrgRulesets: ["GET /orgs/{org}/rulesets"],
getPages: ["GET /repos/{owner}/{repo}/pages"],
getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"],
getPagesDeployment: [
"GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}"
],
getPagesHealthCheck: ["GET /repos/{owner}/{repo}/pages/health"],
getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"],
getPullRequestReviewProtection: [
@ -9486,6 +9613,9 @@ var Endpoints = {
]
},
securityAdvisories: {
createFork: [
"POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks"
],
createPrivateVulnerabilityReport: [
"POST /repos/{owner}/{repo}/security-advisories/reports"
],
@ -9977,7 +10107,7 @@ var import_endpoint = __nccwpck_require__(9440);
var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js
var VERSION = "8.1.6";
var VERSION = "8.2.0";
// pkg/dist-src/is-plain-object.js
function isPlainObject(value) {
@ -10121,11 +10251,17 @@ async function getResponseData(response) {
function toErrorMessage(data) {
if (typeof data === "string")
return data;
let suffix;
if ("documentation_url" in data) {
suffix = ` - ${data.documentation_url}`;
} else {
suffix = "";
}
if ("message" in data) {
if (Array.isArray(data.errors)) {
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}`;
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
}
return data.message;
return `${data.message}${suffix}`;
}
return `Unknown error: ${JSON.stringify(data)}`;
}
@ -15136,134 +15272,6 @@ module.exports = CacheableLookup;
module.exports["default"] = CacheableLookup;
/***/ }),
/***/ 4340:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {PassThrough: PassThroughStream} = __nccwpck_require__(2781);
module.exports = options => {
options = {...options};
const {array} = options;
let {encoding} = options;
const isBuffer = encoding === 'buffer';
let objectMode = false;
if (array) {
objectMode = !(encoding || isBuffer);
} else {
encoding = encoding || 'utf8';
}
if (isBuffer) {
encoding = null;
}
const stream = new PassThroughStream({objectMode});
if (encoding) {
stream.setEncoding(encoding);
}
let length = 0;
const chunks = [];
stream.on('data', chunk => {
chunks.push(chunk);
if (objectMode) {
length = chunks.length;
} else {
length += chunk.length;
}
});
stream.getBufferedValue = () => {
if (array) {
return chunks;
}
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
};
stream.getBufferedLength = () => length;
return stream;
};
/***/ }),
/***/ 7040:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {constants: BufferConstants} = __nccwpck_require__(4300);
const pump = __nccwpck_require__(8341);
const bufferStream = __nccwpck_require__(4340);
class MaxBufferError extends Error {
constructor() {
super('maxBuffer exceeded');
this.name = 'MaxBufferError';
}
}
async function getStream(inputStream, options) {
if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
}
options = {
maxBuffer: Infinity,
...options
};
const {maxBuffer} = options;
let stream;
await new Promise((resolve, reject) => {
const rejectPromise = error => {
// Don't retrieve an oversized buffer.
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
error.bufferedData = stream.getBufferedValue();
}
reject(error);
};
stream = pump(inputStream, bufferStream(options), error => {
if (error) {
rejectPromise(error);
return;
}
resolve();
});
stream.on('data', () => {
if (stream.getBufferedLength() > maxBuffer) {
rejectPromise(new MaxBufferError());
}
});
});
return stream.getBufferedValue();
}
module.exports = getStream;
// TODO: Remove this for the next major release
module.exports["default"] = getStream;
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
module.exports.MaxBufferError = MaxBufferError;
/***/ }),
/***/ 8116:
@ -15275,7 +15283,7 @@ module.exports.MaxBufferError = MaxBufferError;
const EventEmitter = __nccwpck_require__(2361);
const urlLib = __nccwpck_require__(7310);
const normalizeUrl = __nccwpck_require__(7952);
const getStream = __nccwpck_require__(7040);
const getStream = __nccwpck_require__(1766);
const CachePolicy = __nccwpck_require__(1002);
const Response = __nccwpck_require__(9004);
const lowercaseKeys = __nccwpck_require__(9662);
@ -17567,12 +17575,6 @@ function queueAsPromised (context, worker, concurrency) {
}
function drained () {
if (queue.idle()) {
return new Promise(function (resolve) {
resolve()
})
}
var previousDrain = queue.drain
var p = new Promise(function (resolve) {
@ -17847,6 +17849,134 @@ const fill = (start, end, step, options = {}) => {
module.exports = fill;
/***/ }),
/***/ 1585:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {PassThrough: PassThroughStream} = __nccwpck_require__(2781);
module.exports = options => {
options = {...options};
const {array} = options;
let {encoding} = options;
const isBuffer = encoding === 'buffer';
let objectMode = false;
if (array) {
objectMode = !(encoding || isBuffer);
} else {
encoding = encoding || 'utf8';
}
if (isBuffer) {
encoding = null;
}
const stream = new PassThroughStream({objectMode});
if (encoding) {
stream.setEncoding(encoding);
}
let length = 0;
const chunks = [];
stream.on('data', chunk => {
chunks.push(chunk);
if (objectMode) {
length = chunks.length;
} else {
length += chunk.length;
}
});
stream.getBufferedValue = () => {
if (array) {
return chunks;
}
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
};
stream.getBufferedLength = () => length;
return stream;
};
/***/ }),
/***/ 1766:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
const {constants: BufferConstants} = __nccwpck_require__(4300);
const pump = __nccwpck_require__(8341);
const bufferStream = __nccwpck_require__(1585);
class MaxBufferError extends Error {
constructor() {
super('maxBuffer exceeded');
this.name = 'MaxBufferError';
}
}
async function getStream(inputStream, options) {
if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
}
options = {
maxBuffer: Infinity,
...options
};
const {maxBuffer} = options;
let stream;
await new Promise((resolve, reject) => {
const rejectPromise = error => {
// Don't retrieve an oversized buffer.
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
error.bufferedData = stream.getBufferedValue();
}
reject(error);
};
stream = pump(inputStream, bufferStream(options), error => {
if (error) {
rejectPromise(error);
return;
}
resolve();
});
stream.on('data', () => {
if (stream.getBufferedLength() > maxBuffer) {
rejectPromise(new MaxBufferError());
}
});
});
return stream.getBufferedValue();
}
module.exports = getStream;
// TODO: Remove this for the next major release
module.exports["default"] = getStream;
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
module.exports.MaxBufferError = MaxBufferError;
/***/ }),
/***/ 6457:
@ -23323,27 +23453,22 @@ class Keyv extends EventEmitter {
}
if (isArray) {
const result = [];
for (let row of data) {
return data.map((row, index) => {
if ((typeof row === 'string')) {
row = this.opts.deserialize(row);
}
if (row === undefined || row === null) {
result.push(undefined);
continue;
return undefined;
}
if (typeof row.expires === 'number' && Date.now() > row.expires) {
this.delete(key).then(() => undefined);
result.push(undefined);
} else {
result.push((options && options.raw) ? row : row.value);
this.delete(key[index]).then(() => undefined);
return undefined;
}
}
return result;
return (options && options.raw) ? row : row.value;
});
}
if (typeof data.expires === 'number' && Date.now() > data.expires) {
@ -43130,6 +43255,9 @@ function httpRedirectFetch (fetchParams, response) {
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
request.headersList.delete('authorization')
// https://fetch.spec.whatwg.org/#authentication-entries
request.headersList.delete('proxy-authorization', true)
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
request.headersList.delete('cookie')
request.headersList.delete('host')
@ -59361,7 +59489,7 @@ Dicer.prototype._write = function (data, encoding, cb) {
if (this._headerFirst && this._isPreamble) {
if (!this._part) {
this._part = new PartStream(this._partOpts)
if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() }
if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() }
}
const r = this._hparser.push(data)
if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() }
@ -59418,7 +59546,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) {
}
}
if (this._dashes === 2) {
if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) }
if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) }
this.reset()
this._finished = true
// no more parts will be added
@ -59436,7 +59564,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) {
this._part._read = function (n) {
self._unpause()
}
if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() }
if (this._isPreamble && this.listenerCount('preamble') !== 0) {
this.emit('preamble', this._part)
} else if (this._isPreamble !== true && this.listenerCount('part') !== 0) {
this.emit('part', this._part)
} else {
this._ignore()
}
if (!this._isPreamble) { this._inHeader = true }
}
if (data && start < end && !this._ignoreData) {
@ -60119,7 +60253,7 @@ function Multipart (boy, cfg) {
++nfiles
if (!boy._events.file) {
if (boy.listenerCount('file') === 0) {
self.parser._ignore()
return
}
@ -60648,7 +60782,7 @@ const decoders = {
if (textDecoders.has(this.toString())) {
try {
return textDecoders.get(this).decode(data)
} catch (e) { }
} catch {}
}
return typeof data === 'string'
? data

View file

@ -5,7 +5,6 @@ import {GitHub} from '@actions/github/lib/utils'
import type {PullRequest} from '@octokit/webhooks-types'
import * as stream from 'stream'
import {promisify} from 'util'
// eslint-disable-next-line import/no-named-as-default
import got from 'got'
const asyncStream = promisify(stream.pipeline)