Branch

class github.Branch.Branch

This class represents Branches. The reference can be found here https://docs.github.com/en/rest/reference/repos#branches

commit
Type:github.Commit.Commit
name
Type:string
protected
Type:bool
protection_url
Type:string
get_protection()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection
edit_protection(strict=NotSet, contexts=NotSet, enforce_admins=NotSet, dismissal_users=NotSet, dismissal_teams=NotSet, dismiss_stale_reviews=NotSet, require_code_owner_reviews=NotSet, required_approving_review_count=NotSet, user_push_restrictions=NotSet, team_push_restrictions=NotSet)
Calls:PUT /repos/{owner}/{repo}/branches/{branch}/protection
Strict:bool
Contexts:list of strings
Enforce_admins:bool
Dismissal_users:
 list of strings
Dismissal_teams:
 list of strings
Dismiss_stale_reviews:
 bool
Require_code_owner_reviews:
 bool
Required_approving_review_count:
 int
User_push_restrictions:
 list of strings
Team_push_restrictions:
 list of strings

NOTE: The GitHub API groups strict and contexts together, both must be submitted. Take care to pass both as arguments even if only one is changing. Use edit_required_status_checks() to avoid this.

remove_protection()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection
get_required_status_checks()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
Return type:github.RequiredStatusChecks.RequiredStatusChecks
edit_required_status_checks(strict=NotSet, contexts=NotSet)
Calls:PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
Strict:bool
Contexts:list of strings
remove_required_status_checks()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
get_required_pull_request_reviews()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
Return type:github.RequiredPullRequestReviews.RequiredPullRequestReviews
edit_required_pull_request_reviews(dismissal_users=NotSet, dismissal_teams=NotSet, dismiss_stale_reviews=NotSet, require_code_owner_reviews=NotSet, required_approving_review_count=NotSet)
Calls:PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
Dismissal_users:
 list of strings
Dismissal_teams:
 list of strings
Dismiss_stale_reviews:
 bool
Require_code_owner_reviews:
 bool
Required_approving_review_count:
 int
remove_required_pull_request_reviews()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
get_admin_enforcement()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
Return type:bool
set_admin_enforcement()
Calls:POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
remove_admin_enforcement()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
get_user_push_restrictions()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
Return type:github.PaginatedList.PaginatedList of github.NamedUser.NamedUser
get_team_push_restrictions()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
Return type:github.PaginatedList.PaginatedList of github.Team.Team
add_user_push_restrictions(*users)
Calls:POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
Users:list of strings (user names)
replace_user_push_restrictions(*users)
Calls:PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
Users:list of strings (user names)
remove_user_push_restrictions(*users)
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
Users:list of strings (user names)
add_team_push_restrictions(*teams)
Calls:POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
Teams:list of strings (team slugs)
replace_team_push_restrictions(*teams)
Calls:PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
Teams:list of strings (team slugs)
remove_team_push_restrictions(*teams)
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
Teams:list of strings (team slugs)
remove_push_restrictions()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions
get_required_signatures()
Calls:GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures <https://docs.github.com/en/rest/reference/repos#branches>
add_required_signatures()
Calls:POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures <https://docs.github.com/en/rest/reference/repos#branches>
remove_required_signatures()
Calls:DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures <https://docs.github.com/en/rest/reference/repos#branches>