From 315e6e5297aad07d2bf5b36965346ef598882411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Thu, 3 Oct 2024 15:35:52 +0200 Subject: [PATCH] #1967 Adding rename method --- src/main/java/org/kohsuke/github/GHBranch.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index f803c67e70..e9e1f4f9f9 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -192,6 +192,19 @@ public GHCommit merge(String head, String commitMessage) throws IOException { return result; } + /** + * Rename this branch. + * + * @param name + * the name + * @throws IOException + * the io exception + */ + @CheckForNull + public void rename(String name) throws IOException { + root().createRequest().method("POST").with("new_name", name).withUrlPath(getApiRoute() + "/rename").send(); + } + /** * Gets the api route. *