Skip to content

Commit

Permalink
Merge pull request #547 from github/retrying-fix
Browse files Browse the repository at this point in the history
Add back retrying.
  • Loading branch information
chrisgavin authored Jun 7, 2021
2 parents 1644ade + 48efe6e commit 242fd82
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/api-client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/api-client.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/api-client.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/api-client.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/api-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ const pkg = require("../package.json");

setupTests(test);

let pluginStub: sinon.SinonStub;
let githubStub: sinon.SinonStub;

test.beforeEach(() => {
githubStub = sinon.stub(githubUtils, "GitHub");
pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
githubStub = sinon.stub();
pluginStub.returns(githubStub);
initializeEnvironment(Mode.actions, pkg.version);
});

Expand Down
4 changes: 3 additions & 1 deletion src/api-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from "path";

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

import { getRequiredInput } from "./actions-util";
Expand Down Expand Up @@ -33,7 +34,8 @@ export const getApiClient = function (
) {
const auth =
(allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
return new githubUtils.GitHub(
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
return new retryingOctokit(
githubUtils.getOctokitOptions(auth, {
baseUrl: getApiUrl(apiDetails.url),
userAgent: `CodeQL-${getMode()}/${pkg.version}`,
Expand Down

0 comments on commit 242fd82

Please sign in to comment.