diff --git a/__tests__/dependency-graph.test.ts b/__tests__/dependency-graph.test.ts index 4533b2f11..c2c462847 100644 --- a/__tests__/dependency-graph.test.ts +++ b/__tests__/dependency-graph.test.ts @@ -24,7 +24,6 @@ test('it properly catches RequestError type', async () => { headRef: 'refs/heads/master' }) } catch (error) { - const err = error as RequestError - expect(err.status).toBe(401) + expect(error).toBeInstanceOf(RequestError) } }) diff --git a/src/comment-pr.ts b/src/comment-pr.ts index ca448db6d..6e94a977c 100644 --- a/src/comment-pr.ts +++ b/src/comment-pr.ts @@ -1,11 +1,10 @@ import * as github from '@actions/github' import * as core from '@actions/core' import * as githubUtils from '@actions/github/lib/utils' -import {retry} from '@octokit/plugin-retry' +import * as retry from '@octokit/plugin-retry' import {RequestError} from '@octokit/request-error' -import {Octokit} from '@octokit/rest' -const retryingOctokit = Octokit.plugin(retry) +const retryingOctokit = githubUtils.GitHub.plugin(retry.retry) const octo = new retryingOctokit( githubUtils.getOctokitOptions(core.getInput('repo-token', {required: true})) ) diff --git a/src/dependency-graph.ts b/src/dependency-graph.ts index 084211f3b..a3c03d1eb 100644 --- a/src/dependency-graph.ts +++ b/src/dependency-graph.ts @@ -1,16 +1,13 @@ import * as core from '@actions/core' import * as githubUtils from '@actions/github/lib/utils' -import {Octokit} from '@octokit/core' -import {retry} from '@octokit/plugin-retry' -import {paginateRest} from '@octokit/plugin-paginate-rest' - +import * as retry from '@octokit/plugin-retry' import { ChangesSchema, ComparisonResponse, ComparisonResponseSchema } from './schemas' -const retryingOctokit = Octokit.plugin(retry, paginateRest) +const retryingOctokit = githubUtils.GitHub.plugin(retry.retry) const SnapshotWarningsHeader = 'x-github-dependency-graph-snapshot-warnings' const octo = new retryingOctokit( githubUtils.getOctokitOptions(core.getInput('repo-token', {required: true}))