Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49187

Use the GitHub Search API rather than the GitHub Repository API

XMLWordPrintable

      For listing repositories for an organization, I believe the current approach is to iterate through the organization's whole repository list using the listRepositories method while applying the user's defined filter on the result. Even with the configurable steps available, this may not scale well for large organisations with many repositories and regularly hit the API rate limit.

      I believe that this can be improved by instead using the searchRepositories method as this uses GHRepositorySearchBuilder which implements GitHub's v3 search API rather than the repository API.

      With the search API you can then achieve the same desired result by performing filtering using the query parameters available, but using this API would greatly reduce the amount of API calls necessary to return the repositories for an organisation, for example:

       

      /search/repositories?q=org:orgName nameFilter

       

            Unassigned Unassigned
            danjford Daniel Ford
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: