From 490371a92c8aff249a602b3319bde1d2534c397c Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Tue, 5 Oct 2021 10:08:37 +0000 Subject: [PATCH] [projects] paginate listReposAccessibleToInstallation call --- components/server/ee/src/github/github-app-support.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/server/ee/src/github/github-app-support.ts b/components/server/ee/src/github/github-app-support.ts index 369f93ce8fb7ca..b4835427af39ef 100644 --- a/components/server/ee/src/github/github-app-support.ts +++ b/components/server/ee/src/github/github-app-support.ts @@ -42,7 +42,7 @@ export class GitHubAppSupport { const findInstallationForAccount = async (account: string) => { try { return await appApi.apps.getUserInstallation({ username: account }) - } catch (error) { + } catch (error: any) { if (error instanceof RequestError) { // ignore 404 - not found } else { @@ -53,8 +53,8 @@ export class GitHubAppSupport { const listReposForInstallation = async (installation: RestEndpointMethodTypes["apps"]["getUserInstallation"]["response"]) => { const sub = await probot.auth(installation.data.id); try { - const accessibleRepos = await sub.apps.listReposAccessibleToInstallation({ per_page: 100 }); - return accessibleRepos.data.repositories.map(r => { + const accessibleRepos = (await sub.paginate(sub.rest.apps.listReposAccessibleToInstallation, { per_page: 100 })); + return accessibleRepos.repositories.map(r => { return { name: r.name, cloneUrl: r.clone_url, @@ -65,7 +65,7 @@ export class GitHubAppSupport { installationUpdatedAt: installation.data.updated_at }; }); - } catch (error) { + } catch (error: any) { if (error instanceof RequestError) { // ignore 404 - not found } else {