From 3c78883ba3fc7e9fbba6dde6fda7615367b15cc4 Mon Sep 17 00:00:00 2001 From: kim5566 Date: Fri, 10 Sep 2021 17:55:29 +1000 Subject: [PATCH] fix formatting and slection of returned results Signed-off-by: kim5566 --- .changeset/clever-months-switch.md | 5 +++++ .../integration/src/github/GithubCredentialsProvider.ts | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/clever-months-switch.md diff --git a/.changeset/clever-months-switch.md b/.changeset/clever-months-switch.md new file mode 100644 index 0000000000..9ffac60f56 --- /dev/null +++ b/.changeset/clever-months-switch.md @@ -0,0 +1,5 @@ +--- +'@backstage/integration': patch +--- + +Handle pagination on return results when fetch GitHub API to list selected repos diff --git a/packages/integration/src/github/GithubCredentialsProvider.ts b/packages/integration/src/github/GithubCredentialsProvider.ts index 330187b140..3156488ba7 100644 --- a/packages/integration/src/github/GithubCredentialsProvider.ts +++ b/packages/integration/src/github/GithubCredentialsProvider.ts @@ -110,9 +110,10 @@ class GithubAppManager { const installationClient = new Octokit({ auth: result.data.token, }); - const repos = - await installationClient.paginate(installationClient.apps.listReposAccessibleToInstallation); - const hasRepo = repos && repos.repositories.some(repository => { + const repos = await installationClient.paginate( + installationClient.apps.listReposAccessibleToInstallation, + ); + const hasRepo = repos.some(repository => { return repository.name === repo; }); if (!hasRepo) {