Skip to content

Commit

Permalink
Merge pull request #390
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Oct 28, 2017
2 parents b443e86 + e94ba74 commit 9b0ace2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/kohsuke/github/GHLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@ public String getColor() {
public void delete() throws IOException {
repo.root.retrieve().method("DELETE").to(url);
}

/**
* @param newColor
* 6-letter hex color code, like "f29513"
*/
public void setColor(String newColor) throws IOException {
repo.root.retrieve().method("PATCH").with("name", name).with("color", newColor).to(url);
}
}
4 changes: 4 additions & 0 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ public void testRepoLabel() throws IOException {
assertEquals(t.getColor(), "123456");
assertEquals(t.getColor(), t2.getColor());
assertEquals(t.getUrl(), t2.getUrl());

t.setColor("000000");
GHLabel t3 = r.getLabel("test");
assertEquals(t3.getColor(), "000000");
t.delete();
}
}
Expand Down

0 comments on commit 9b0ace2

Please sign in to comment.