diff --git a/pom.xml b/pom.xml
index 52c763940e..8d8bf52cbe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
github-api
- 1.54
+ 1.55
GitHub API for Java
http://github-api.kohsuke.org/
GitHub API for Java
@@ -16,7 +16,7 @@
scm:git:git@github.com/kohsuke/${project.artifactId}.git
scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git
http://${project.artifactId}.kohsuke.org/
- HEAD
+ github-api-1.55
diff --git a/src/main/java/org/kohsuke/github/GHCommitStatus.java b/src/main/java/org/kohsuke/github/GHCommitStatus.java
index 319e13cc64..af9f1d31ca 100644
--- a/src/main/java/org/kohsuke/github/GHCommitStatus.java
+++ b/src/main/java/org/kohsuke/github/GHCommitStatus.java
@@ -16,6 +16,7 @@ public class GHCommitStatus {
String target_url,description;
int id;
String url;
+ String context;
GHUser creator;
private GitHub root;
@@ -69,4 +70,8 @@ public String getUrl() {
public GHUser getCreator() {
return creator;
}
+
+ public String getContext() {
+ return context;
+ }
}
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index 5dfe545057..294347b596 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -658,14 +658,24 @@ public GHCommitStatus getLastCommitStatus(String sha1) throws IOException {
* Optional parameter that points to the URL that has more details.
* @param 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)
.with("state", state.name().toLowerCase(Locale.ENGLISH))
.with("target_url", targetUrl)
.with("description", description)
+ .with("context", context)
.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.
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index a1c231953a..0866a8e93a 100644
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -555,15 +555,28 @@ public void directoryListing() throws IOException {
@Test
public void testAddDeployKey() throws IOException {
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");
- assertNotNull(newDeployKey.getId());
-
- Iterables.find( myRepository.getDeployKeys(),new Predicate() {
- public boolean apply(GHDeployKey deployKey) {
- return newDeployKey.getId() == deployKey.getId() ;
- }
- });
- newDeployKey.delete();
+ 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());
+
+ GHDeployKey k = Iterables.find(myRepository.getDeployKeys(), new Predicate() {
+ public boolean apply(GHDeployKey deployKey) {
+ return newDeployKey.getId() == deployKey.getId();
+ }
+ });
+ assertNotNull(k);
+ } finally {
+ 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() {