java.lang.Object
org.kohsuke.github.GHBranchProtectionBuilder
Builder to configure the branch protection settings.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddRequiredChecks
(GHBranchProtection.Check... checks) Add required checks gh branch protection builder.Add required checks gh branch protection builder.Allow deletion of the protected branch.allowDeletions
(boolean v) Allows deletion of the protected branch by anyone with write access to the repository.Permits force pushes.allowForcePushes
(boolean v) Permits force pushes to the protected branch by anyone with write access to the repository.Allow fork syncing.allowForkSyncing
(boolean v) Whether users can pull changes from upstream when the branch is locked.Restrict new branch creation.blockCreations
(boolean v) If set to true, the restrictions branch protection settings which limits who can push will also block pushes which create new branches, unless the push is initiated by a user, team, or app which has the ability to push.Dismiss stale reviews gh branch protection builder.dismissStaleReviews
(boolean v) Dismiss stale reviews gh branch protection builder.enable()
Enable gh branch protection.Include admins gh branch protection builder.includeAdmins
(boolean v) Include admins gh branch protection builder.Set the branch as read-only.lockBranch
(boolean v) Whether to set the branch as read-only.Require branch is up to date gh branch protection builder.requireBranchIsUpToDate
(boolean v) Require branch is up to date gh branch protection builder.Require code own reviews gh branch protection builder.requireCodeOwnReviews
(boolean v) Require code own reviews gh branch protection builder.Require all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule.requiredConversationResolution
(boolean v) Require all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule.Enforce a linear commit Git history.requiredLinearHistory
(boolean v) Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch.requiredReviewers
(int v) Required reviewers gh branch protection builder.Enable the most recent push must be approved by someone other than the person who pushed it.requireLastPushApproval
(boolean v) Whether the most recent push must be approved by someone other than the person who pushed it.Require reviews gh branch protection builder.Restrict push access gh branch protection builder.Restrict review dismissals gh branch protection builder.teamPushAccess
(Collection<GHTeam> teams) Team push access gh branch protection builder.teamPushAccess
(GHTeam... teams) Team push access gh branch protection builder.teamReviewDismissals
(Collection<GHTeam> teams) Team review dismissals gh branch protection builder.teamReviewDismissals
(GHTeam... teams) Team review dismissals gh branch protection builder.userPushAccess
(Collection<GHUser> users) User push access gh branch protection builder.userPushAccess
(GHUser... users) User push access gh branch protection builder.userReviewDismissals
(Collection<GHUser> users) User review dismissals gh branch protection builder.userReviewDismissals
(GHUser... users) User review dismissals gh branch protection builder.
-
Method Details
-
addRequiredStatusChecks
public GHBranchProtectionBuilder addRequiredStatusChecks(Collection<GHBranchProtection.Check> checks) Add required checks gh branch protection builder.- Parameters:
checks
- the checks- Returns:
- the gh branch protection builder
-
addRequiredChecks
Add required checks gh branch protection builder.- Parameters:
checks
- the checks- Returns:
- the gh branch protection builder
-
allowDeletions
Allow deletion of the protected branch.- Returns:
- the gh branch protection builder
-
allowDeletions
Allows deletion of the protected branch by anyone with write access to the repository. Set to true to allow deletion of the protected branch. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
allowForcePushes
Permits force pushes.- Returns:
- the gh branch protection builder
-
allowForcePushes
Permits force pushes to the protected branch by anyone with write access to the repository. Set to true to allow force pushes. Set to false to block force pushes. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
allowForkSyncing
Allow fork syncing.- Returns:
- the gh branch protection builder
-
allowForkSyncing
Whether users can pull changes from upstream when the branch is locked. Set to true to allow fork syncing. Set to true to enable. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
blockCreations
Restrict new branch creation.- Returns:
- the gh branch protection builder
-
blockCreations
If set to true, the restrictions branch protection settings which limits who can push will also block pushes which create new branches, unless the push is initiated by a user, team, or app which has the ability to push. Set to true to restrict new branch creation. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
dismissStaleReviews
Dismiss stale reviews gh branch protection builder.- Returns:
- the gh branch protection builder
-
dismissStaleReviews
Dismiss stale reviews gh branch protection builder.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
enable
Enable gh branch protection.- Returns:
- the gh branch protection
- Throws:
IOException
- the io exception
-
includeAdmins
Include admins gh branch protection builder.- Returns:
- the gh branch protection builder
-
includeAdmins
Include admins gh branch protection builder.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
lockBranch
Set the branch as read-only.- Returns:
- the gh branch protection builder
-
lockBranch
Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. Set to true to enable. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requiredReviewers
Required reviewers gh branch protection builder.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requireBranchIsUpToDate
Require branch is up to date gh branch protection builder.- Returns:
- the gh branch protection builder
-
requireBranchIsUpToDate
Require branch is up to date gh branch protection builder.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requireCodeOwnReviews
Require code own reviews gh branch protection builder.- Returns:
- the gh branch protection builder
-
requireCodeOwnReviews
Require code own reviews gh branch protection builder.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requireLastPushApproval
Enable the most recent push must be approved by someone other than the person who pushed it.- Returns:
- the gh branch protection builder
-
requireLastPushApproval
Whether the most recent push must be approved by someone other than the person who pushed it. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requiredConversationResolution
Require all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule.- Returns:
- the gh branch protection builder
-
requiredConversationResolution
Require all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule. Set to true to enable. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requiredLinearHistory
Enforce a linear commit Git history.- Returns:
- the gh branch protection builder
-
requiredLinearHistory
Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to true to enforce a linear commit history. Set to false to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: false.- Parameters:
v
- the v- Returns:
- the gh branch protection builder
-
requireReviews
Require reviews gh branch protection builder.- Returns:
- the gh branch protection builder
-
restrictReviewDismissals
Restrict review dismissals gh branch protection builder.- Returns:
- the gh branch protection builder
-
restrictPushAccess
Restrict push access gh branch protection builder.- Returns:
- the gh branch protection builder
-
teamPushAccess
Team push access gh branch protection builder.- Parameters:
teams
- the teams- Returns:
- the gh branch protection builder
-
teamPushAccess
Team push access gh branch protection builder.- Parameters:
teams
- the teams- Returns:
- the gh branch protection builder
-
teamReviewDismissals
Team review dismissals gh branch protection builder.- Parameters:
teams
- the teams- Returns:
- the gh branch protection builder
-
teamReviewDismissals
Team review dismissals gh branch protection builder.- Parameters:
teams
- the teams- Returns:
- the gh branch protection builder
-
userPushAccess
User push access gh branch protection builder.- Parameters:
users
- the users- Returns:
- the gh branch protection builder
-
userPushAccess
User push access gh branch protection builder.- Parameters:
users
- the users- Returns:
- the gh branch protection builder
-
userReviewDismissals
User review dismissals gh branch protection builder.- Parameters:
users
- the users- Returns:
- the gh branch protection builder
-
userReviewDismissals
User review dismissals gh branch protection builder.- Parameters:
users
- the users- Returns:
- the gh branch protection builder
-