Skip to content

Commit

Permalink
Labels: add method to update color
Browse files Browse the repository at this point in the history
  • Loading branch information
batmat committed Oct 25, 2017
1 parent b443e86 commit 569fa06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 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,8 @@ public String getColor() {
public void delete() throws IOException {
repo.root.retrieve().method("DELETE").to(url);
}

public void updateColor(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.updateColor("000000");
GHLabel t3 = r.getLabel("test");
assertEquals(t3.getColor(), "000000");
t.delete();
}
}
Expand Down

0 comments on commit 569fa06

Please sign in to comment.