diff --git a/action-src/tsconfig.json b/action-src/tsconfig.json index efa415f2c..335dbf22a 100644 --- a/action-src/tsconfig.json +++ b/action-src/tsconfig.json @@ -2,17 +2,13 @@ "$schema": "https://json.schemastore.org/tsconfig", "extends": "@tsconfig/node12/tsconfig.json", "compilerOptions": { - "skipLibCheck": false, + "skipLibCheck": true, "noUnusedParameters": true, "noUnusedLocals": true, "moduleResolution": "node", "outDir": "../action/lib", "rootDir": "./src" }, - "include": [ - "src/**/*" - ], - "exclude": [ - "node_modules" - ] + "include": ["src/**/*"], + "exclude": ["node_modules"] } diff --git a/action/node_modules/@octokit/request/dist-node/index.js b/action/node_modules/@octokit/request/dist-node/index.js index 11ac3f42b..f9e66fd99 100644 --- a/action/node_modules/@octokit/request/dist-node/index.js +++ b/action/node_modules/@octokit/request/dist-node/index.js @@ -10,7 +10,7 @@ var isPlainObject = require('is-plain-object'); var nodeFetch = _interopDefault(require('node-fetch')); var requestError = require('@octokit/request-error'); -const VERSION = "6.2.3"; +const VERSION = "6.2.4"; function getBufferResponse(response) { return response.arrayBuffer(); @@ -29,7 +29,12 @@ function fetchWrapper(requestOptions) { method: requestOptions.method, body: requestOptions.body, headers: requestOptions.headers, - redirect: requestOptions.redirect + redirect: requestOptions.redirect, + // duplex must be set if request.body is ReadableStream or Async Iterables. + // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex. + ...(requestOptions.body && { + duplex: "half" + }) }, // `requestOptions.request.agent` type is incompatible // see https://github.com/octokit/types.ts/pull/264 diff --git a/action/node_modules/@octokit/request/dist-src/fetch-wrapper.js b/action/node_modules/@octokit/request/dist-src/fetch-wrapper.js deleted file mode 100644 index 223307aaa..000000000 --- a/action/node_modules/@octokit/request/dist-src/fetch-wrapper.js +++ /dev/null @@ -1,123 +0,0 @@ -import { isPlainObject } from "is-plain-object"; -import nodeFetch from "node-fetch"; -import { RequestError } from "@octokit/request-error"; -import getBuffer from "./get-buffer-response"; -export default function fetchWrapper(requestOptions) { - const log = requestOptions.request && requestOptions.request.log - ? requestOptions.request.log - : console; - if (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) || - globalThis.fetch || - /* istanbul ignore next */ 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(response.statusText, status, { - response: { - url, - status, - headers, - data: undefined, - }, - request: requestOptions, - }); - } - if (status === 304) { - throw new 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(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) - throw error; - else if (error.name === "AbortError") - throw error; - throw new 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 getBuffer(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)}`; -} diff --git a/action/node_modules/@octokit/request/dist-src/get-buffer-response.js b/action/node_modules/@octokit/request/dist-src/get-buffer-response.js deleted file mode 100644 index 845a3947b..000000000 --- a/action/node_modules/@octokit/request/dist-src/get-buffer-response.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function getBufferResponse(response) { - return response.arrayBuffer(); -} diff --git a/action/node_modules/@octokit/request/dist-src/index.js b/action/node_modules/@octokit/request/dist-src/index.js deleted file mode 100644 index 2460e992c..000000000 --- a/action/node_modules/@octokit/request/dist-src/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { endpoint } from "@octokit/endpoint"; -import { getUserAgent } from "universal-user-agent"; -import { VERSION } from "./version"; -import withDefaults from "./with-defaults"; -export const request = withDefaults(endpoint, { - headers: { - "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`, - }, -}); diff --git a/action/node_modules/@octokit/request/dist-src/version.js b/action/node_modules/@octokit/request/dist-src/version.js deleted file mode 100644 index 4b40fe81b..000000000 --- a/action/node_modules/@octokit/request/dist-src/version.js +++ /dev/null @@ -1 +0,0 @@ -export const VERSION = "6.2.3"; diff --git a/action/node_modules/@octokit/request/dist-src/with-defaults.js b/action/node_modules/@octokit/request/dist-src/with-defaults.js deleted file mode 100644 index e20642945..000000000 --- a/action/node_modules/@octokit/request/dist-src/with-defaults.js +++ /dev/null @@ -1,22 +0,0 @@ -import fetchWrapper from "./fetch-wrapper"; -export default 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), - }); -} diff --git a/action/node_modules/@octokit/request/dist-web/index.js b/action/node_modules/@octokit/request/dist-web/index.js deleted file mode 100644 index bf549a453..000000000 --- a/action/node_modules/@octokit/request/dist-web/index.js +++ /dev/null @@ -1,162 +0,0 @@ -import { endpoint } from '@octokit/endpoint'; -import { getUserAgent } from 'universal-user-agent'; -import { isPlainObject } from 'is-plain-object'; -import nodeFetch from 'node-fetch'; -import { RequestError } from '@octokit/request-error'; - -const VERSION = "6.2.3"; - -function getBufferResponse(response) { - return response.arrayBuffer(); -} - -function fetchWrapper(requestOptions) { - const log = requestOptions.request && requestOptions.request.log - ? requestOptions.request.log - : console; - if (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) || - globalThis.fetch || - /* istanbul ignore next */ 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(response.statusText, status, { - response: { - url, - status, - headers, - data: undefined, - }, - request: requestOptions, - }); - } - if (status === 304) { - throw new 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(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) - throw error; - else if (error.name === "AbortError") - throw error; - throw new 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, { - headers: { - "user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`, - }, -}); - -export { request }; -//# sourceMappingURL=index.js.map diff --git a/action/node_modules/@octokit/request/package.json b/action/node_modules/@octokit/request/package.json index 53910add4..3f38a5379 100644 --- a/action/node_modules/@octokit/request/package.json +++ b/action/node_modules/@octokit/request/package.json @@ -1,7 +1,7 @@ { "name": "@octokit/request", "description": "Send parameterized requests to GitHub's APIs with sensible defaults in browsers and Node", - "version": "6.2.3", + "version": "6.2.4", "license": "MIT", "files": [ "dist-*/", @@ -43,11 +43,11 @@ "fetch-mock": "^9.3.1", "jest": "^29.0.0", "lolex": "^6.0.0", - "prettier": "2.8.3", + "prettier": "2.8.8", "semantic-release-plugin-update-version-in-files": "^1.0.0", "string-to-arraybuffer": "^1.0.2", "ts-jest": "^29.0.0", - "typescript": "^4.0.2" + "typescript": "^5.0.0" }, "engines": { "node": ">= 14" diff --git a/package.json b/package.json index d9a764863..ff0539517 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "prepare": "yarn sync && yarn build", "sync": "node sync_package.mjs", "build": "yarn workspace action-src build", + "clean": "yarn workspace action-src clean", "clean-build": "yarn workspace action-src clean-build", "smoke-test-push": "env-cmd -f ./fixtures/push.json node ./action/lib/main_root.js", "smoke-test": "env-cmd -f ./fixtures/pull_request.json node ./action/lib/main_root.js", diff --git a/yarn.lock b/yarn.lock index 3cc4c55b8..1923d5039 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1102,9 +1102,9 @@ universal-user-agent "^6.0.0" "@octokit/request@^6.0.0": - version "6.2.3" - resolved "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz#76d5d6d44da5c8d406620a4c285d280ae310bdb4" - integrity sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA== + version "6.2.4" + resolved "https://registry.npmjs.org/@octokit/request/-/request-6.2.4.tgz#b00a7185865c72bdd432e63168b1e900953ded0c" + integrity sha512-at92SYQstwh7HH6+Kf3bFMnHrle7aIrC0r5rTP+Bb30118B6j1vI2/M4walh6qcQgfuLIKs8NUO5CytHTnUI3A== dependencies: "@octokit/endpoint" "^7.0.0" "@octokit/request-error" "^3.0.0" @@ -1314,9 +1314,9 @@ integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== "@types/node@*": - version "20.1.5" - resolved "https://registry.npmjs.org/@types/node/-/node-20.1.5.tgz#e94b604c67fc408f215fcbf3bd84d4743bf7f710" - integrity sha512-IvGD1CD/nego63ySR7vrAKEX3AJTcmrAN2kn+/sDNLi1Ff5kBzDeEdqWDplK+0HAEoLYej137Sk0cUU8OLOlMg== + version "20.1.7" + resolved "https://registry.npmjs.org/@types/node/-/node-20.1.7.tgz#ce10c802f7731909d0a44ac9888e8b3a9125eb62" + integrity sha512-WCuw/o4GSwDGMoonES8rcvwsig77dGCMbZDrZr2x4ZZiNW4P/gcoZXe/0twgtobcTkmg9TuKflxYL/DuwDyJzg== "@types/prettier@^2.1.5": version "2.7.2" @@ -2101,9 +2101,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.4.284: - version "1.4.396" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.396.tgz#3d3664eb58d86376fbe2fece3705f68ca197205c" - integrity sha512-pqKTdqp/c5vsrc0xUPYXTDBo9ixZuGY8es4ZOjjd6HD6bFYbu5QA09VoW3fkY4LF1T0zYk86lN6bZnNlBuOpdQ== + version "1.4.397" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.397.tgz#82a7e26c657538d59bb713b97ac22f97ea3a90ea" + integrity sha512-jwnPxhh350Q/aMatQia31KAIQdhEsYS0fFZ0BQQlN9tfvOEwShu6ZNwI4kL/xBabjcB/nTy6lSt17kNIluJZ8Q== emittery@^0.13.1: version "0.13.1" @@ -2722,9 +2722,9 @@ is-arrayish@^0.2.1: integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-core-module@^2.11.0: - version "2.12.0" - resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz#36ad62f6f73c8253fd6472517a12483cf03e7ec4" - integrity sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ== + version "2.12.1" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== dependencies: has "^1.0.3"