Skip to content

Commit

Permalink
Add missing branch protection fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gheine committed Oct 20, 2023
1 parent 38baf5d commit 63708d1
Show file tree
Hide file tree
Showing 2 changed files with 338 additions and 3 deletions.
154 changes: 154 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 @@ -120,6 +141,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 +238,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 +347,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 63708d1

Please sign in to comment.