-
Notifications
You must be signed in to change notification settings - Fork 375
JENKINS-72894 - Adding support to more than 1000 repositories #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
6019f86
e46ab52
642b3c3
aefef4f
0837320
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1019,7 +1019,7 @@ public void visitSources(SCMSourceObserver observer) throws IOException, Interru | |
String.format( | ||
"Looking up repositories for topics: '%s'", | ||
gitHubSCMNavigatorContext.getTopics()))); | ||
repositories = searchRepositories(github, gitHubSCMNavigatorContext); | ||
repositories = searchRepositories(github, gitHubSCMNavigatorContext, myself); | ||
} else { | ||
repositories = myself.listRepositories(100); | ||
} | ||
|
@@ -1114,7 +1114,7 @@ public void visitSources(SCMSourceObserver observer) throws IOException, Interru | |
String.format( | ||
"Looking up repositories for topics: '%s'", | ||
gitHubSCMNavigatorContext.getTopics()))); | ||
repositories = searchRepositories(github, gitHubSCMNavigatorContext); | ||
repositories = searchRepositories(github, gitHubSCMNavigatorContext, org); | ||
} else { | ||
repositories = org.listRepositories(100); | ||
} | ||
|
@@ -1239,13 +1239,35 @@ public void visitSources(SCMSourceObserver observer) throws IOException, Interru | |
} | ||
} | ||
|
||
private Iterable<GHRepository> searchRepositories(final GitHub github, final GitHubSCMNavigatorContext context) { | ||
private Iterable<GHRepository> searchRepositories(final GitHub github, final GitHubSCMNavigatorContext context, final GHOrganization org) { | ||
final GHRepositorySearchBuilder ghRepositorySearchBuilder = github.searchRepositories(); | ||
context.getTopics().forEach(ghRepositorySearchBuilder::topic); | ||
ghRepositorySearchBuilder.org(getRepoOwner()); | ||
if (!context.isExcludeForkedRepositories()) { | ||
ghRepositorySearchBuilder.q("fork:true"); | ||
} | ||
|
||
// Only the first 1000 search results are available | ||
if (ghRepositorySearchBuilder.list().getTotalCount() > 1000) { | ||
return org.listRepositories(100); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks to me like this is ignoring all the search settings above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello, the query above only returns the first 1000 records. This is a github limitation. |
||
} | ||
|
||
return ghRepositorySearchBuilder.list().withPageSize(100); | ||
} | ||
|
||
private Iterable<GHRepository> searchRepositories(final GitHub github, final GitHubSCMNavigatorContext context, final GHMyself myself) { | ||
final GHRepositorySearchBuilder ghRepositorySearchBuilder = github.searchRepositories(); | ||
context.getTopics().forEach(ghRepositorySearchBuilder::topic); | ||
ghRepositorySearchBuilder.org(getRepoOwner()); | ||
if (!context.isExcludeForkedRepositories()) { | ||
ghRepositorySearchBuilder.q("fork:true"); | ||
} | ||
|
||
// Only the first 1000 search results are available | ||
if (ghRepositorySearchBuilder.list().getTotalCount() > 1000) { | ||
return myself.listRepositories(100); | ||
} | ||
|
||
return ghRepositorySearchBuilder.list().withPageSize(100); | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.