mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-23 08:21:22 +00:00
Added API to list contributors
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.kohsuke.github.GHRepository.Contributor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -21,6 +22,24 @@ public class RepositoryTest extends AbstractGitHubApiTestBase {
|
||||
assertNull(r.getSubscription());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listContributors() throws IOException {
|
||||
GHRepository r = gitHub.getOrganization("stapler").getRepository("stapler");
|
||||
int i=0;
|
||||
boolean kohsuke = false;
|
||||
|
||||
for (Contributor c : r.listContributors()) {
|
||||
System.out.println(c.getName());
|
||||
assertTrue(c.getContributions()>0);
|
||||
if (c.getLogin().equals("kohsuke"))
|
||||
kohsuke = true;
|
||||
if (i++ > 5)
|
||||
break;
|
||||
}
|
||||
|
||||
assertTrue(kohsuke);
|
||||
}
|
||||
|
||||
private GHRepository getRepository() throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("jenkins");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user