From ded987cb3bb8fe573c2a64e52bcf137724692b22 Mon Sep 17 00:00:00 2001 From: Federico Builes Date: Wed, 8 Nov 2023 08:34:26 +0100 Subject: [PATCH] Downgrade usage of retries. This commit reverts: f7363549ac613351d1e2378d8cd623c1eb1ec884 76b050a607f625d3153b002cf21e0d50e7a12658 8dc52cdbed80b6f7430e3d7b9388b247d3c976c6 --- __tests__/dependency-graph.test.ts | 3 +-- src/comment-pr.ts | 5 ++--- src/dependency-graph.ts | 7 ++----- 3 files changed, 5 insertions(+), 10 deletions(-) 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}))