mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add required_linear_history attribute to BranchProtection (#2643)
Co-authored-by: Jacob Beard <jake@minnow.io> Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
This commit is contained in:
co-authored by
Jacob Beard
Paul Melnikow
parent
2edc0f8f17
commit
7a80fad9bb
@@ -51,6 +51,7 @@ class BranchProtection(github.GithubObject.CompletableGithubObject):
|
||||
self._url: Attribute[str] = NotSet
|
||||
self._required_status_checks: Attribute[RequiredStatusChecks] = NotSet
|
||||
self._enforce_admins: Attribute[bool] = NotSet
|
||||
self._required_linear_history: Attribute[bool] = github.GithubObject.NotSet
|
||||
self._required_pull_request_reviews: Attribute[RequiredPullRequestReviews] = NotSet
|
||||
self._user_push_restrictions: Opt[str] = NotSet
|
||||
self._team_push_restrictions: Opt[str] = NotSet
|
||||
@@ -70,6 +71,11 @@ class BranchProtection(github.GithubObject.CompletableGithubObject):
|
||||
self._completeIfNotSet(self._enforce_admins)
|
||||
return self._enforce_admins.value
|
||||
|
||||
@property
|
||||
def required_linear_history(self) -> bool:
|
||||
self._completeIfNotSet(self._required_linear_history)
|
||||
return self._required_linear_history.value
|
||||
|
||||
@property
|
||||
def required_pull_request_reviews(self) -> RequiredPullRequestReviews:
|
||||
self._completeIfNotSet(self._required_pull_request_reviews)
|
||||
@@ -105,6 +111,8 @@ class BranchProtection(github.GithubObject.CompletableGithubObject):
|
||||
github.RequiredPullRequestReviews.RequiredPullRequestReviews,
|
||||
attributes["required_pull_request_reviews"],
|
||||
)
|
||||
if "required_linear_history" in attributes: # pragma no branch
|
||||
self._required_linear_history = self._makeBoolAttribute(attributes["required_linear_history"]["enabled"])
|
||||
if "restrictions" in attributes: # pragma no branch
|
||||
self._user_push_restrictions = attributes["restrictions"]["users_url"]
|
||||
self._team_push_restrictions = attributes["restrictions"]["teams_url"]
|
||||
|
||||
Reference in New Issue
Block a user