Skip to content

Commit

Permalink
Merge pull request #212 from umajeric/master
Browse files Browse the repository at this point in the history
Added option to edit GitHub release once it is created
  • Loading branch information
kohsuke committed Aug 11, 2015
2 parents ec450b8 + 76d2831 commit e3ebf6e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/kohsuke/github/GHRelease.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public boolean isDraft() {
return draft;
}

public GHRelease setDraft(boolean draft) throws IOException {
edit("draft", draft);
this.draft = draft;
return this;
}

public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
}
Expand Down Expand Up @@ -149,6 +155,13 @@ public void delete() throws IOException {
new Requester(root).method("DELETE").to(owner.getApiTailUrl("releases/"+id));
}

/**
* Edit this release.
*/
private void edit(String key, Object value) throws IOException {
new Requester(root)._with(key, value).method("PATCH").to(owner.getApiTailUrl("releases/"+id));
}

private String getApiTailUrl(String end) {
return owner.getApiTailUrl(format("releases/%s/%s",id,end));
}
Expand Down

0 comments on commit e3ebf6e

Please sign in to comment.