From eef58e2e01f9eb36c8f77332761976c6158b9b49 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 22 Feb 2021 08:48:34 +0100 Subject: [PATCH] fix(github): paginate all check-runs --- lib/platform/github/__snapshots__/index.spec.ts.snap | 12 ++++++------ lib/platform/github/index.spec.ts | 12 ++++++------ lib/platform/github/index.ts | 3 ++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index 04620e028a..41eee3b17c 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -2461,7 +2461,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; @@ -2603,7 +2603,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; @@ -2665,7 +2665,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; @@ -2727,7 +2727,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; @@ -2789,7 +2789,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; @@ -2851,7 +2851,7 @@ Array [ "user-agent": "https://github.com/renovatebot/renovate", }, "method": "GET", - "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs", + "url": "https://api.github.com/repos/some/repo/commits/somebranch/check-runs?per_page=100", }, ] `; diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index e3e4a95005..2f35b846cc 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -595,7 +595,7 @@ describe('platform/github', () => { .reply(200, { state: 'success', }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, []); await github.initRepo({ @@ -613,7 +613,7 @@ describe('platform/github', () => { .reply(200, { state: 'failure', }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, []); await github.initRepo({ @@ -631,7 +631,7 @@ describe('platform/github', () => { .reply(200, { state: 'unknown', }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, []); await github.initRepo({ repository: 'some/repo', @@ -649,7 +649,7 @@ describe('platform/github', () => { state: 'pending', statuses: [], }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, { total_count: 2, check_runs: [ @@ -683,7 +683,7 @@ describe('platform/github', () => { state: 'pending', statuses: [], }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, { total_count: 3, check_runs: [ @@ -723,7 +723,7 @@ describe('platform/github', () => { state: 'pending', statuses: [], }) - .get('/repos/some/repo/commits/somebranch/check-runs') + .get('/repos/some/repo/commits/somebranch/check-runs?per_page=100') .reply(200, { total_count: 2, check_runs: [ diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index d2f92be8a6..c4b742b2c8 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -837,11 +837,12 @@ export async function getBranchStatus( try { const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash( branchName - )}/check-runs`; + )}/check-runs?per_page=100`; const opts = { headers: { accept: 'application/vnd.github.antiope-preview+json', }, + paginate: true, }; const checkRunsRaw = ( await githubApi.getJson<{ -- GitLab