Skip to content

Commit 198fede

Browse files
committed
Merge pull request hub4j#325
2 parents 1266dcc + 1212ae3 commit 198fede

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package org.kohsuke.github;
22

3-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4-
import org.kohsuke.github.BranchProtection.RequiredStatusChecks;
3+
import static org.kohsuke.github.Previews.LOKI;
54

65
import java.io.IOException;
6+
import java.net.URL;
77
import java.util.Arrays;
88
import java.util.Collection;
99

10-
import static org.kohsuke.github.Previews.LOKI;
10+
import org.kohsuke.github.BranchProtection.RequiredStatusChecks;
11+
12+
import com.fasterxml.jackson.annotation.JsonProperty;
13+
14+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1115

1216
/**
1317
* A branch in a repository.
@@ -22,6 +26,10 @@ public class GHBranch {
2226

2327
private String name;
2428
private Commit commit;
29+
@JsonProperty("protected")
30+
private boolean protection;
31+
private String protection_url;
32+
2533

2634
public static class Commit {
2735
String sha;
@@ -45,6 +53,23 @@ public String getName() {
4553
return name;
4654
}
4755

56+
/**
57+
* Returns true if the push to this branch is restricted via branch protection.
58+
*/
59+
@Preview @Deprecated
60+
public boolean isProtected() {
61+
return protection;
62+
}
63+
64+
/**
65+
* Returns API URL that deals with the protection of this branch.
66+
*/
67+
@Preview @Deprecated
68+
public URL getProtectionUrl() {
69+
return GitHub.parseURL(protection_url);
70+
}
71+
72+
4873
/**
4974
* The commit that this branch currently points to.
5075
*/

0 commit comments

Comments
 (0)