Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit e3ebf6e

Browse files
committed
Merge pull request hub4j#212 from umajeric/master
Added option to edit GitHub release once it is created
2 parents ec450b8 + 76d2831 commit e3ebf6e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public boolean isDraft() {
4545
return draft;
4646
}
4747

48+
public GHRelease setDraft(boolean draft) throws IOException {
49+
edit("draft", draft);
50+
this.draft = draft;
51+
return this;
52+
}
53+
4854
public URL getHtmlUrl() {
4955
return GitHub.parseURL(html_url);
5056
}
@@ -149,6 +155,13 @@ public void delete() throws IOException {
149155
new Requester(root).method("DELETE").to(owner.getApiTailUrl("releases/"+id));
150156
}
151157

158+
/**
159+
* Edit this release.
160+
*/
161+
private void edit(String key, Object value) throws IOException {
162+
new Requester(root)._with(key, value).method("PATCH").to(owner.getApiTailUrl("releases/"+id));
163+
}
164+
152165
private String getApiTailUrl(String end) {
153166
return owner.getApiTailUrl(format("releases/%s/%s",id,end));
154167
}

0 commit comments

Comments
 (0)