mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-14 15:50:05 +00:00
Compare commits
7 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0cf1ac605 | ||
|
|
9a19d07ab8 | ||
|
|
922be0b164 | ||
|
|
d0b8e2e37e | ||
|
|
e3d6e08b6a | ||
|
|
16a6623095 | ||
|
|
7bf31ca149 |
4
pom.xml
4
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.54</version>
|
<version>1.55</version>
|
||||||
<name>GitHub API for Java</name>
|
<name>GitHub API for Java</name>
|
||||||
<url>http://github-api.kohsuke.org/</url>
|
<url>http://github-api.kohsuke.org/</url>
|
||||||
<description>GitHub API for Java</description>
|
<description>GitHub API for Java</description>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<connection>scm:git:git@github.com/kohsuke/${project.artifactId}.git</connection>
|
<connection>scm:git:git@github.com/kohsuke/${project.artifactId}.git</connection>
|
||||||
<developerConnection>scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git</developerConnection>
|
<developerConnection>scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git</developerConnection>
|
||||||
<url>http://${project.artifactId}.kohsuke.org/</url>
|
<url>http://${project.artifactId}.kohsuke.org/</url>
|
||||||
<tag>HEAD</tag>
|
<tag>github-api-1.55</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class GHCommitStatus {
|
|||||||
String target_url,description;
|
String target_url,description;
|
||||||
int id;
|
int id;
|
||||||
String url;
|
String url;
|
||||||
|
String context;
|
||||||
GHUser creator;
|
GHUser creator;
|
||||||
|
|
||||||
private GitHub root;
|
private GitHub root;
|
||||||
@@ -69,4 +70,8 @@ public class GHCommitStatus {
|
|||||||
public GHUser getCreator() {
|
public GHUser getCreator() {
|
||||||
return creator;
|
return creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -658,15 +658,25 @@ public class GHRepository {
|
|||||||
* Optional parameter that points to the URL that has more details.
|
* Optional parameter that points to the URL that has more details.
|
||||||
* @param description
|
* @param description
|
||||||
* Optional short description.
|
* Optional short description.
|
||||||
|
* @param context
|
||||||
|
* Optinal commit status context.
|
||||||
*/
|
*/
|
||||||
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException {
|
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description, String context) throws IOException {
|
||||||
return new Requester(root)
|
return new Requester(root)
|
||||||
.with("state", state.name().toLowerCase(Locale.ENGLISH))
|
.with("state", state.name().toLowerCase(Locale.ENGLISH))
|
||||||
.with("target_url", targetUrl)
|
.with("target_url", targetUrl)
|
||||||
.with("description", description)
|
.with("description", description)
|
||||||
|
.with("context", context)
|
||||||
.to(String.format("/repos/%s/%s/statuses/%s",owner.login,this.name,sha1),GHCommitStatus.class).wrapUp(root);
|
.to(String.format("/repos/%s/%s/statuses/%s",owner.login,this.name,sha1),GHCommitStatus.class).wrapUp(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see {@link #createCommitStatus(String, GHCommitState,String,String,String) createCommitStatus}
|
||||||
|
*/
|
||||||
|
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException {
|
||||||
|
return createCommitStatus(sha1, state, targetUrl, description,null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists repository events.
|
* Lists repository events.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -555,16 +555,29 @@ public class AppTest extends AbstractGitHubApiTestBase {
|
|||||||
@Test
|
@Test
|
||||||
public void testAddDeployKey() throws IOException {
|
public void testAddDeployKey() throws IOException {
|
||||||
GHRepository myRepository = Iterables.get(gitHub.getMyself().getRepositories().values(),0);
|
GHRepository myRepository = Iterables.get(gitHub.getMyself().getRepositories().values(),0);
|
||||||
final GHDeployKey newDeployKey = myRepository.addDeployKey("test", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC55wA5wHqTFMk3OkyHqtmgSAmIanREVP4ukMrPZFzYfRBaKYPCbBRxu7ddzF3oZ+i6ZV8+rH8hvhQTYl5LtOIxLUppsVVNSB9YKXQv37LLaWul9WoJPdXHGWfR3wlhRXsg1sMPpbgu60lXAl7xvx729FEjKEEHRMGkPbcIeHkov/tlEg9oQdqFC1Pqnv/lCsZ5UKRPLHY3V9pmSaEplwmwb//HppNtEYr9t6VNvOMjqbUrbhsilKu0t6qa3G7Kb47kvfJwMn+DKD2XJMYHYHMyHtHcFK8RIOSX8I+Bu4yeVmvcooSL65FBCIrmVoejkI7gZWDfgWVRboQ9RyB+VeXL example@example.com");
|
final GHDeployKey newDeployKey = myRepository.addDeployKey("test", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUt0RAycC5cS42JKh6SecfFZBR1RrF+2hYMctz4mk74/arBE+wFb7fnSHGzdGKX2h5CFOWODifRCJVhB7hlVxodxe+QkQQYAEL/x1WVCJnGgTGQGOrhOMj95V3UE5pQKhsKD608C+u5tSofcWXLToP1/wZ7U4/AHjqYi08OLsWToHCax55TZkvdt2jo0hbIoYU+XI9Q8Uv4ONDN1oabiOdgeKi8+crvHAuvNleiBhWVBzFh8KdfzaH5uNdw7ihhFjEd1vzqACsjCINCjdMfzl6jD9ExuWuE92nZJnucls2cEoNC6k2aPmrZDg9hA32FXVpyseY+bDUWFU6LO2LG6PB kohsuke@atlas");
|
||||||
|
try {
|
||||||
assertNotNull(newDeployKey.getId());
|
assertNotNull(newDeployKey.getId());
|
||||||
|
|
||||||
Iterables.find( myRepository.getDeployKeys(),new Predicate<GHDeployKey>() {
|
GHDeployKey k = Iterables.find(myRepository.getDeployKeys(), new Predicate<GHDeployKey>() {
|
||||||
public boolean apply(GHDeployKey deployKey) {
|
public boolean apply(GHDeployKey deployKey) {
|
||||||
return newDeployKey.getId() == deployKey.getId();
|
return newDeployKey.getId() == deployKey.getId();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
assertNotNull(k);
|
||||||
|
} finally {
|
||||||
newDeployKey.delete();
|
newDeployKey.delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCommitStatusContext() throws IOException {
|
||||||
|
GHRepository myRepository = Iterables.get(gitHub.getMyself().getRepositories().values(), 0);
|
||||||
|
GHRef masterRef = myRepository.getRef("heads/master");
|
||||||
|
GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject().getSha(), GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
|
||||||
|
assertEquals("test/context", commitStatus.getContext());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void kohsuke() {
|
private void kohsuke() {
|
||||||
String login = getUser().getLogin();
|
String login = getUser().getLogin();
|
||||||
|
|||||||
Reference in New Issue
Block a user