From 0e026dc348281449acb1ee3e2393b1df08bf4dfc Mon Sep 17 00:00:00 2001 From: Dalton Scharff Date: Fri, 27 Aug 2021 15:47:08 -0500 Subject: [PATCH 1/3] updates @octokit/plugin-enterprise-compatibility to version 1.3.0 and modifies error headers accordingly --- packages/core/package.json | 2 +- packages/core/src/__tests__/git.test.ts | 4 ++- packages/core/src/git.ts | 6 ++--- yarn.lock | 33 ++++++++++++++++--------- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 91c7cac84..1d3fa078d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -39,7 +39,7 @@ "dependencies": { "@auto-it/bot-list": "link:../../packages/bot-list", "@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2", - "@octokit/plugin-enterprise-compatibility": "^1.2.2", + "@octokit/plugin-enterprise-compatibility": "1.3.0", "@octokit/plugin-retry": "^3.0.1", "@octokit/plugin-throttling": "^3.2.0", "@octokit/rest": "^18.0.0", diff --git a/packages/core/src/__tests__/git.test.ts b/packages/core/src/__tests__/git.test.ts index 604538986..dd5a50fb7 100644 --- a/packages/core/src/__tests__/git.test.ts +++ b/packages/core/src/__tests__/git.test.ts @@ -791,7 +791,9 @@ describe("github", () => { name: "Request failed", message: "The request has failed", status: 404, - headers, + response: { + headers + } }); // eslint-disable-next-line no-new diff --git a/packages/core/src/git.ts b/packages/core/src/git.ts index 98c87921d..43aacb86a 100644 --- a/packages/core/src/git.ts +++ b/packages/core/src/git.ts @@ -163,11 +163,11 @@ export default class Git { }, }, }); - this.github.hook.error("request", (error) => { + this.github.hook.error("request", (error: any) => { if (error) { // narrow down the type - if ("headers" in error && error.headers.authorization) { - delete error.headers.authorization; + if (error.response && error.response.headers && error.response.headers.authorization) { + delete error.response.headers.authorization; } } diff --git a/yarn.lock b/yarn.lock index 381dfa4c5..b52439ad9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,14 +13,14 @@ integrity sha512-K1kQv1BZVtMXQqdpNZt9Pgh85KwamsWX9gYyq1xG4cpyb+EacfMiNfumrju16piFXanCUrCR0P1DowPjV2qV/A== "@auto-it/bot-list@link:packages/bot-list": - version "10.30.0" + version "10.31.0" "@auto-it/core@link:packages/core": - version "10.30.0" + version "10.31.0" dependencies: "@auto-it/bot-list" "link:packages/bot-list" "@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2" - "@octokit/plugin-enterprise-compatibility" "^1.2.2" + "@octokit/plugin-enterprise-compatibility" "1.3.0" "@octokit/plugin-retry" "^3.0.1" "@octokit/plugin-throttling" "^3.2.0" "@octokit/rest" "^18.0.0" @@ -59,7 +59,7 @@ url-join "^4.0.0" "@auto-it/npm@link:plugins/npm": - version "10.30.0" + version "10.31.0" dependencies: "@auto-it/core" "link:packages/core" "@auto-it/package-json-utils" "link:packages/package-json-utils" @@ -77,13 +77,13 @@ user-home "^2.0.0" "@auto-it/package-json-utils@link:packages/package-json-utils": - version "10.30.0" + version "10.31.0" dependencies: parse-author "^2.0.0" parse-github-url "1.0.2" "@auto-it/released@link:plugins/released": - version "10.30.0" + version "10.31.0" dependencies: "@auto-it/bot-list" "link:packages/bot-list" "@auto-it/core" "link:packages/core" @@ -2340,12 +2340,12 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-7.0.0.tgz#0f6992db9854af15eca77d71ab0ec7fad2f20411" integrity sha512-gV/8DJhAL/04zjTI95a7FhQwS6jlEE0W/7xeYAzuArD0KVAVWDLP2f3vi98hs3HLTczxXdRK/mF0tRoQPpolEw== -"@octokit/plugin-enterprise-compatibility@^1.2.2": - version "1.2.11" - resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-compatibility/-/plugin-enterprise-compatibility-1.2.11.tgz#b150aa0104e6e9d963c5ababdcb4c43f22b1752c" - integrity sha512-bFCxP7q1q2bzK/H9C+NW4JNmdlwvjYFh7+J0SEdjklo9Q0K40s9IhKC4+DUaoCYCVSJv8aiiXIp660Hc15SbtA== +"@octokit/plugin-enterprise-compatibility@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-compatibility/-/plugin-enterprise-compatibility-1.3.0.tgz#034f035cc1789b0f0d616e71e41f50f73804e89e" + integrity sha512-h34sMGdEOER/OKrZJ55v26ntdHb9OPfR1fwOx6Q4qYyyhWA104o11h9tFxnS/l41gED6WEI41Vu2G2zHDVC5lQ== dependencies: - "@octokit/request-error" "^2.0.4" + "@octokit/request-error" "^2.1.0" "@octokit/types" "^6.0.3" "@octokit/plugin-enterprise-rest@^6.0.1": @@ -2404,6 +2404,15 @@ "@octokit/types" "^6.0.1" bottleneck "^2.15.3" +"@octokit/request-error@2.1.0", "@octokit/request-error@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677" + integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg== + dependencies: + "@octokit/types" "^6.0.3" + deprecation "^2.0.0" + once "^1.4.0" + "@octokit/request-error@^1.0.2": version "1.2.1" resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.2.1.tgz#ede0714c773f32347576c25649dc013ae6b31801" @@ -2413,7 +2422,7 @@ deprecation "^2.0.0" once "^1.4.0" -"@octokit/request-error@^2.0.0", "@octokit/request-error@^2.0.4", "@octokit/request-error@^2.0.5": +"@octokit/request-error@^2.0.0", "@octokit/request-error@^2.0.5": version "2.0.5" resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.0.5.tgz#72cc91edc870281ad583a42619256b380c600143" integrity sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg== From bc427bcf371fe7b26cfc241bed0dd74e30d20e36 Mon Sep 17 00:00:00 2001 From: Dalton Scharff Date: Tue, 11 Jan 2022 11:36:19 -0600 Subject: [PATCH 2/3] uses optional chain expression to fix lintng error --- packages/core/src/git.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/git.ts b/packages/core/src/git.ts index 98c87921d..e25976099 100644 --- a/packages/core/src/git.ts +++ b/packages/core/src/git.ts @@ -166,8 +166,8 @@ export default class Git { this.github.hook.error("request", (error) => { if (error) { // narrow down the type - if ("headers" in error && error.headers.authorization) { - delete error.headers.authorization; + if ("headers" in error && error.headers?.authorization) { + delete error.headers?.authorization; } } From aad65595dc55eb1f770826aab34aff85201c37ae Mon Sep 17 00:00:00 2001 From: Dalton Scharff Date: Thu, 10 Feb 2022 15:26:18 -0600 Subject: [PATCH 3/3] removes linting changes --- packages/core/src/git.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/git.ts b/packages/core/src/git.ts index f629737d6..72212af5b 100644 --- a/packages/core/src/git.ts +++ b/packages/core/src/git.ts @@ -163,11 +163,11 @@ export default class Git { }, }, }); - this.github.hook.error("request", (error: any) => { + this.github.hook.error("request", (error) => { if (error) { // narrow down the type - if ("headers" in error && error.headers?.authorization) { - delete error.headers?.authorization; + if ("headers" in error && error.headers.authorization) { + delete error.headers.authorization; } }