Skip to content

Commit

Permalink
feat(publisher-github): add retry support (#2550)
Browse files Browse the repository at this point in the history
  • Loading branch information
malept authored Sep 27, 2021
1 parent e4a364d commit a400066
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/publisher/github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion packages/publisher/github/src/util/github.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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;
}
}
5 changes: 5 additions & 0 deletions packages/publisher/github/test/github_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a400066

Please sign in to comment.