Skip to content

Commit 242fd82

Browse files
authored
Merge pull request #547 from github/retrying-fix
Add back retrying.
2 parents 1644ade + 48efe6e commit 242fd82

6 files changed

+16
-6
lines changed

lib/api-client.js

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.test.js

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api-client.test.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api-client.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ const pkg = require("../package.json");
1111

1212
setupTests(test);
1313

14+
let pluginStub: sinon.SinonStub;
1415
let githubStub: sinon.SinonStub;
1516

1617
test.beforeEach(() => {
17-
githubStub = sinon.stub(githubUtils, "GitHub");
18+
pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
19+
githubStub = sinon.stub();
20+
pluginStub.returns(githubStub);
1821
initializeEnvironment(Mode.actions, pkg.version);
1922
});
2023

src/api-client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from "path";
22

33
import * as githubUtils from "@actions/github/lib/utils";
4+
import * as retry from "@octokit/plugin-retry";
45
import consoleLogLevel from "console-log-level";
56

67
import { getRequiredInput } from "./actions-util";
@@ -33,7 +34,8 @@ export const getApiClient = function (
3334
) {
3435
const auth =
3536
(allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
36-
return new githubUtils.GitHub(
37+
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
38+
return new retryingOctokit(
3739
githubUtils.getOctokitOptions(auth, {
3840
baseUrl: getApiUrl(apiDetails.url),
3941
userAgent: `CodeQL-${getMode()}/${pkg.version}`,

0 commit comments

Comments
 (0)