From 569fa06d2dd51877b3df7b7807c60ae18e167198 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Wed, 25 Oct 2017 14:06:28 +0200 Subject: [PATCH] Labels: add method to update color --- src/main/java/org/kohsuke/github/GHLabel.java | 4 ++++ src/test/java/org/kohsuke/github/AppTest.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java index 5d1b3b48a2..83a6964a97 100644 --- a/src/main/java/org/kohsuke/github/GHLabel.java +++ b/src/main/java/org/kohsuke/github/GHLabel.java @@ -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); + } } diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java index 7087920dd7..6c7a84bbc3 100755 --- a/src/test/java/org/kohsuke/github/AppTest.java +++ b/src/test/java/org/kohsuke/github/AppTest.java @@ -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(); } }