Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ihrigb authored Nov 7, 2023
2 parents 462c4da + ccf1ade commit deb4113
Show file tree
Hide file tree
Showing 50 changed files with 2,745 additions and 51 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.317-SNAPSHOT</version>
<version>1.318-SNAPSHOT</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
Expand Down Expand Up @@ -60,7 +60,7 @@
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.13.0</version>
<version>2.0.1</version>
</extension>
<!-- Doing site publishing manually for now -->
<!--
Expand Down Expand Up @@ -357,7 +357,7 @@
<plugin>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-injector</artifactId>
<version>1.23</version>
<version>1.29</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -520,7 +520,7 @@
<dependency>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-annotation</artifactId>
<version>1.23</version>
<version>1.29</version>
<optional>true</optional>
</dependency>
<!-- for stapler-jetty -->
Expand Down Expand Up @@ -553,7 +553,7 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.4.0.202211300538-r</version>
<version>6.7.0.202309050840-r</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
217 changes: 217 additions & 0 deletions src/main/java/org/kohsuke/github/GHBranchProtection.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,30 @@
public class GHBranchProtection extends GitHubInteractiveObject {
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";

@JsonProperty
private AllowDeletions allowDeletions;

@JsonProperty
private AllowForcePushes allowForcePushes;

@JsonProperty
private AllowForkSyncing allowForkSyncing;

@JsonProperty
private BlockCreations blockCreations;

@JsonProperty
private EnforceAdmins enforceAdmins;

@JsonProperty
private LockBranch lockBranch;

@JsonProperty
private RequiredConversationResolution requiredConversationResolution;

@JsonProperty
private RequiredLinearHistory requiredLinearHistory;

@JsonProperty("required_pull_request_reviews")
private RequiredReviews requiredReviews;

Expand Down Expand Up @@ -59,6 +80,42 @@ public void disableSignedCommits() throws IOException {
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send();
}

/**
* Gets allow deletions.
*
* @return the enforce admins
*/
public AllowDeletions getAllowDeletions() {
return allowDeletions;
}

/**
* Gets allow force pushes.
*
* @return the enforce admins
*/
public AllowForcePushes getAllowForcePushes() {
return allowForcePushes;
}

/**
* Gets allow fork syncing.
*
* @return the enforce admins
*/
public AllowForkSyncing getAllowForkSyncing() {
return allowForkSyncing;
}

/**
* Gets block creations.
*
* @return the enforce admins
*/
public BlockCreations getBlockCreations() {
return blockCreations;
}

/**
* Gets enforce admins.
*
Expand All @@ -68,6 +125,33 @@ public EnforceAdmins getEnforceAdmins() {
return enforceAdmins;
}

/**
* Gets lock branch.
*
* @return the enforce admins
*/
public LockBranch getLockBranch() {
return lockBranch;
}

/**
* Gets required conversation resolution.
*
* @return the enforce admins
*/
public RequiredConversationResolution getRequiredConversationResolution() {
return requiredConversationResolution;
}

/**
* Gets required linear history.
*
* @return the enforce admins
*/
public RequiredLinearHistory getRequiredLinearHistory() {
return requiredLinearHistory;
}

/**
* Gets required reviews.
*
Expand Down Expand Up @@ -120,6 +204,74 @@ private Requester requester() {
return root().createRequest().withPreview(ZZZAX);
}

/**
* The type AllowDeletions.
*/
public static class AllowDeletions {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type AllowForcePushes.
*/
public static class AllowForcePushes {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type AllowForkSyncing.
*/
public static class AllowForkSyncing {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type BlockCreations.
*/
public static class BlockCreations {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type EnforceAdmins.
*/
Expand Down Expand Up @@ -149,17 +301,73 @@ public boolean isEnabled() {
}
}

/**
* The type LockBranch.
*/
public static class LockBranch {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type RequiredConversationResolution.
*/
public static class RequiredConversationResolution {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type RequiredLinearHistory.
*/
public static class RequiredLinearHistory {
@JsonProperty
private boolean enabled;

/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}

/**
* The type RequiredReviews.
*/
public static class RequiredReviews {
@JsonProperty("dismissal_restrictions")
private Restrictions dismissalRestriction;

@JsonProperty
private boolean dismissStaleReviews;

@JsonProperty
private boolean requireCodeOwnerReviews;

@JsonProperty
private boolean requireLastPushApproval;

@JsonProperty("required_approving_review_count")
private int requiredReviewers;

Expand Down Expand Up @@ -202,6 +410,15 @@ public boolean isRequireCodeOwnerReviews() {
return requireCodeOwnerReviews;
}

/**
* Is require last push approval boolean.
*
* @return the boolean
*/
public boolean isRequireLastPushApproval() {
return requireLastPushApproval;
}

/**
* Gets required reviewers.
*
Expand Down
Loading

0 comments on commit deb4113

Please sign in to comment.