diff --git a/package.json b/package.json index a411bda7d0..b91cd59d35 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@electron/get": "^1.9.0", "@malept/cross-spawn-promise": "^2.0.0", "@octokit/core": "^3.2.4", + "@octokit/plugin-retry": "^3.0.9", "@octokit/rest": "^18.0.11", "@octokit/types": "^6.1.2", "@types/which": "^2.0.0", diff --git a/packages/publisher/github/package.json b/packages/publisher/github/package.json index 2ba80f34f4..00e5659023 100644 --- a/packages/publisher/github/package.json +++ b/packages/publisher/github/package.json @@ -25,6 +25,7 @@ "@electron-forge/publisher-base": "6.0.0-beta.61", "@electron-forge/shared-types": "6.0.0-beta.61", "@octokit/core": "^3.2.4", + "@octokit/plugin-retry": "^3.0.9", "@octokit/rest": "^18.0.11", "@octokit/types": "^6.1.2", "debug": "^4.3.1", diff --git a/packages/publisher/github/src/util/github.ts b/packages/publisher/github/src/util/github.ts index 2c0996e539..716678539d 100644 --- a/packages/publisher/github/src/util/github.ts +++ b/packages/publisher/github/src/util/github.ts @@ -1,5 +1,6 @@ import debug from 'debug'; import { Octokit } from '@octokit/rest'; +import { retry } from '@octokit/plugin-retry'; import { OctokitOptions } from '@octokit/core/dist-types/types.d'; const logInfo = debug('electron-forge:publisher:github:info'); @@ -40,7 +41,8 @@ export default class GitHub { if (this.token) { options.auth = this.token; } - const github = new Octokit(options); + const RetryableOctokit = Octokit.plugin(retry); + const github = new RetryableOctokit(options); return github; } } diff --git a/packages/publisher/github/test/github_spec.ts b/packages/publisher/github/test/github_spec.ts index ef7ed96cef..5cf32e3bd4 100644 --- a/packages/publisher/github/test/github_spec.ts +++ b/packages/publisher/github/test/github_spec.ts @@ -20,6 +20,11 @@ describe('GitHub', () => { gitHubSpy(); this.options = options; } + + // eslint-disable-next-line @typescript-eslint/ban-types + static plugin(): object { + return this; + } }; GitHub = proxyquire.noCallThru().load('../src/util/github', { '@octokit/rest': { diff --git a/yarn.lock b/yarn.lock index 349008a811..53c837035b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2021,6 +2021,14 @@ "@octokit/types" "^6.31.0" deprecation "^2.3.1" +"@octokit/plugin-retry@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz#ae625cca1e42b0253049102acd71c1d5134788fe" + integrity sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ== + dependencies: + "@octokit/types" "^6.0.3" + bottleneck "^2.15.3" + "@octokit/request-error@^2.0.5", "@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" @@ -3147,6 +3155,11 @@ boolean@^3.0.1: resolved "https://registry.yarnpkg.com/boolean/-/boolean-3.1.4.tgz#f51a2fb5838a99e06f9b6ec1edb674de67026435" integrity sha512-3hx0kwU3uzG6ReQ3pnaFQPSktpBw6RHN3/ivDKEuU8g1XSfafowyvDnadjv1xp8IZqhtSukxlwv9bF6FhX8m0w== +bottleneck@^2.15.3: + version "2.19.5" + resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.19.5.tgz#5df0b90f59fd47656ebe63c78a98419205cadd91" + integrity sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw== + bowser@^2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f"