Skip to content

Commit

Permalink
Merge pull request #1732 from gheine/main
Browse files Browse the repository at this point in the history
Add missing branch protection fields
  • Loading branch information
bitwiseman authored Nov 6, 2023
2 parents 88a81b3 + 5c2fd6c commit ccf1ade
Show file tree
Hide file tree
Showing 6 changed files with 487 additions and 21 deletions.
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 ccf1ade

Please sign in to comment.