Skip to content

Commit f607b09

Browse files
authored
Merge pull request #1355 from jetersen/patch-1
add org filter to repository search
2 parents 9b164ca + 8de03e2 commit f607b09

File tree

4 files changed

+3257
-0
lines changed

4 files changed

+3257
-0
lines changed

src/main/java/org/kohsuke/github/GHRepositorySearchBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ public GHRepositorySearchBuilder topic(String v) {
221221
return q("topic:" + v);
222222
}
223223

224+
/**
225+
* Org gh repository search builder.
226+
*
227+
* @param v
228+
* the v
229+
* @return the gh repository search builder
230+
*/
231+
public GHRepositorySearchBuilder org(String v) {
232+
return q("org:" + v);
233+
}
234+
224235
/**
225236
* Order gh repository search builder.
226237
*

src/test/java/org/kohsuke/github/GHRepositoryTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,14 @@ public void searchRepositories() throws Exception {
550550
assertThat(r.getTotalCount(), greaterThan(0));
551551
}
552552

553+
@Test
554+
public void searchOrgForRepositories() throws Exception {
555+
PagedSearchIterable<GHRepository> r = gitHub.searchRepositories().org("hub4j-test-org").list();
556+
GHRepository u = r.iterator().next();
557+
assertThat(u.getOwnerName(), equalTo("hub4j-test-org"));
558+
assertThat(r.getTotalCount(), greaterThan(0));
559+
}
560+
553561
@Test // issue #162
554562
public void testIssue162() throws Exception {
555563
GHRepository r = gitHub.getRepository("hub4j/github-api");

0 commit comments

Comments
 (0)