Add allow_auto_merge support to Repository (#2477)

Co-authored-by: Glenn McDonald <testworksau@users.noreply.github.com>
This commit is contained in:
BradChengIRESS
2023-05-18 15:33:18 -04:00
committed by GitHub
co-authored by Glenn McDonald
parent 4fa0a5f3f0
commit 8c4b9465e6
3 changed files with 23 additions and 2 deletions
+19
View File
@@ -159,6 +159,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
def __repr__(self):
return self.get__repr__({"full_name": self._full_name.value})
@property
def allow_auto_merge(self):
"""
:type: bool
"""
self._completeIfNotSet(self._allow_auto_merge)
return self._allow_auto_merge.value
@property
def allow_forking(self):
"""
@@ -1569,6 +1577,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
has_wiki=github.GithubObject.NotSet,
has_downloads=github.GithubObject.NotSet,
default_branch=github.GithubObject.NotSet,
allow_auto_merge=github.GithubObject.NotSet,
allow_forking=github.GithubObject.NotSet,
allow_squash_merge=github.GithubObject.NotSet,
allow_merge_commit=github.GithubObject.NotSet,
@@ -1624,6 +1633,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
assert default_branch is github.GithubObject.NotSet or isinstance(
default_branch, str
), default_branch
assert allow_auto_merge is github.GithubObject.NotSet or isinstance(
allow_auto_merge, bool
), allow_auto_merge
assert allow_forking is github.GithubObject.NotSet or isinstance(
allow_forking, bool
), allow_forking
@@ -1666,6 +1678,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
post_parameters["default_branch"] = default_branch
if allow_squash_merge is not github.GithubObject.NotSet:
post_parameters["allow_squash_merge"] = allow_squash_merge
if allow_auto_merge is not github.GithubObject.NotSet:
post_parameters["allow_auto_merge"] = allow_auto_merge
if allow_forking is not github.GithubObject.NotSet:
post_parameters["allow_forking"] = allow_forking
if allow_merge_commit is not github.GithubObject.NotSet:
@@ -3835,6 +3849,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
)
def _initAttributes(self):
self._allow_auto_merge = github.GithubObject.NotSet
self._allow_forking = github.GithubObject.NotSet
self._allow_merge_commit = github.GithubObject.NotSet
self._allow_rebase_merge = github.GithubObject.NotSet
@@ -3923,6 +3938,10 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._watchers_count = github.GithubObject.NotSet
def _useAttributes(self, attributes):
if "allow_auto_merge" in attributes: # pragma no branch
self._allow_auto_merge = self._makeBoolAttribute(
attributes["allow_auto_merge"]
)
if "allow_forking" in attributes: # pragma no branch
self._allow_forking = self._makeBoolAttribute(attributes["allow_forking"])
if "allow_merge_commit" in attributes: # pragma no branch