Class GHBranchProtectionBuilder

java.lang.Object
org.kohsuke.github.GHBranchProtectionBuilder

public class GHBranchProtectionBuilder extends Object
Builder to configure the branch protection settings.
See Also:
  • 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

      public GHBranchProtectionBuilder addRequiredChecks(GHBranchProtection.Check... checks)
      Add required checks gh branch protection builder.
      Parameters:
      checks - the checks
      Returns:
      the gh branch protection builder
    • allowDeletions

      public GHBranchProtectionBuilder allowDeletions()
      Allow deletion of the protected branch.
      Returns:
      the gh branch protection builder
    • allowDeletions

      public GHBranchProtectionBuilder allowDeletions(boolean v)
      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

      public GHBranchProtectionBuilder allowForcePushes()
      Permits force pushes.
      Returns:
      the gh branch protection builder
    • allowForcePushes

      public GHBranchProtectionBuilder allowForcePushes(boolean v)
      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

      public GHBranchProtectionBuilder allowForkSyncing()
      Allow fork syncing.
      Returns:
      the gh branch protection builder
    • allowForkSyncing

      public GHBranchProtectionBuilder allowForkSyncing(boolean v)
      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

      public GHBranchProtectionBuilder blockCreations()
      Restrict new branch creation.
      Returns:
      the gh branch protection builder
    • blockCreations

      public GHBranchProtectionBuilder 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. Set to true to restrict new branch creation. Default: false.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • dismissStaleReviews

      public GHBranchProtectionBuilder dismissStaleReviews()
      Dismiss stale reviews gh branch protection builder.
      Returns:
      the gh branch protection builder
    • dismissStaleReviews

      public GHBranchProtectionBuilder dismissStaleReviews(boolean v)
      Dismiss stale reviews gh branch protection builder.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • enable

      public GHBranchProtection enable() throws IOException
      Enable gh branch protection.
      Returns:
      the gh branch protection
      Throws:
      IOException - the io exception
    • includeAdmins

      public GHBranchProtectionBuilder includeAdmins()
      Include admins gh branch protection builder.
      Returns:
      the gh branch protection builder
    • includeAdmins

      public GHBranchProtectionBuilder includeAdmins(boolean v)
      Include admins gh branch protection builder.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • lockBranch

      public GHBranchProtectionBuilder lockBranch()
      Set the branch as read-only.
      Returns:
      the gh branch protection builder
    • lockBranch

      public GHBranchProtectionBuilder lockBranch(boolean v)
      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

      public GHBranchProtectionBuilder requiredReviewers(int v)
      Required reviewers gh branch protection builder.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • requireBranchIsUpToDate

      public GHBranchProtectionBuilder requireBranchIsUpToDate()
      Require branch is up to date gh branch protection builder.
      Returns:
      the gh branch protection builder
    • requireBranchIsUpToDate

      public GHBranchProtectionBuilder requireBranchIsUpToDate(boolean v)
      Require branch is up to date gh branch protection builder.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • requireCodeOwnReviews

      public GHBranchProtectionBuilder requireCodeOwnReviews()
      Require code own reviews gh branch protection builder.
      Returns:
      the gh branch protection builder
    • requireCodeOwnReviews

      public GHBranchProtectionBuilder requireCodeOwnReviews(boolean v)
      Require code own reviews gh branch protection builder.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • requireLastPushApproval

      public GHBranchProtectionBuilder 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

      public GHBranchProtectionBuilder requireLastPushApproval(boolean v)
      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

      public GHBranchProtectionBuilder 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

      public GHBranchProtectionBuilder 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. Set to true to enable. Default: false.
      Parameters:
      v - the v
      Returns:
      the gh branch protection builder
    • requiredLinearHistory

      public GHBranchProtectionBuilder requiredLinearHistory()
      Enforce a linear commit Git history.
      Returns:
      the gh branch protection builder
    • requiredLinearHistory

      public GHBranchProtectionBuilder requiredLinearHistory(boolean v)
      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

      public GHBranchProtectionBuilder requireReviews()
      Require reviews gh branch protection builder.
      Returns:
      the gh branch protection builder
    • restrictReviewDismissals

      public GHBranchProtectionBuilder restrictReviewDismissals()
      Restrict review dismissals gh branch protection builder.
      Returns:
      the gh branch protection builder
    • restrictPushAccess

      public GHBranchProtectionBuilder restrictPushAccess()
      Restrict push access gh branch protection builder.
      Returns:
      the gh branch protection builder
    • teamPushAccess

      public GHBranchProtectionBuilder teamPushAccess(Collection<GHTeam> teams)
      Team push access gh branch protection builder.
      Parameters:
      teams - the teams
      Returns:
      the gh branch protection builder
    • teamPushAccess

      public GHBranchProtectionBuilder teamPushAccess(GHTeam... teams)
      Team push access gh branch protection builder.
      Parameters:
      teams - the teams
      Returns:
      the gh branch protection builder
    • teamReviewDismissals

      public GHBranchProtectionBuilder teamReviewDismissals(Collection<GHTeam> teams)
      Team review dismissals gh branch protection builder.
      Parameters:
      teams - the teams
      Returns:
      the gh branch protection builder
    • teamReviewDismissals

      public GHBranchProtectionBuilder teamReviewDismissals(GHTeam... teams)
      Team review dismissals gh branch protection builder.
      Parameters:
      teams - the teams
      Returns:
      the gh branch protection builder
    • userPushAccess

      public GHBranchProtectionBuilder userPushAccess(Collection<GHUser> users)
      User push access gh branch protection builder.
      Parameters:
      users - the users
      Returns:
      the gh branch protection builder
    • userPushAccess

      public GHBranchProtectionBuilder userPushAccess(GHUser... users)
      User push access gh branch protection builder.
      Parameters:
      users - the users
      Returns:
      the gh branch protection builder
    • userReviewDismissals

      public GHBranchProtectionBuilder userReviewDismissals(Collection<GHUser> users)
      User review dismissals gh branch protection builder.
      Parameters:
      users - the users
      Returns:
      the gh branch protection builder
    • userReviewDismissals

      public GHBranchProtectionBuilder userReviewDismissals(GHUser... users)
      User review dismissals gh branch protection builder.
      Parameters:
      users - the users
      Returns:
      the gh branch protection builder