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) {