Repository: PyGithub/PyGithub

Issue:
Add support of `allow_auto_merge` attribute to Repository
Adds the `allow_auto_merge` attribute to a Repository: https://docs.github.com/en/rest/repos/repos#update-a-repository

> `allow_auto_merge` boolean
> Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.

This attribute can be modified via edit (on a private repository):

```
>>> g.get_repo("<test repo>").allow_auto_merge
True
>>> g.get_repo("<test repo>").edit(allow_auto_merge=False)
>>> g.get_repo("<test repo>").allow_auto_merge
False
>>> g.get_repo("<test repo>").edit(allow_auto_merge=True)
>>> g.get_repo("<test repo>").allow_auto_merge
True
```


Discussion:

Resolving patch:
diff --git a/github/Repository.py b/github/Repository.py
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -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 @@ def edit(
         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 @@ def edit(
         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 @@ def edit(
             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 @@ def get_codescan_alerts(self):
         )
 
     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 @@ def _initAttributes(self):
         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


Test patch:
diff --git a/tests/ReplayData/Repository.testEditWithAllArguments.txt b/tests/ReplayData/Repository.testEditWithAllArguments.txt
--- a/tests/ReplayData/Repository.testEditWithAllArguments.txt
+++ b/tests/ReplayData/Repository.testEditWithAllArguments.txt
@@ -4,10 +4,10 @@ api.github.com
 None
 /repos/jacquev6/PyGithub
 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
-{"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
+{"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
 200
 [('status', '200 OK'), ('x-ratelimit-remaining', '4953'), ('content-length', '1109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"749313ec2d171323deb61f9f4c85e84f"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')]
-{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
+{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true}
 
 https
 PATCH
diff --git a/tests/Repository.py b/tests/Repository.py
--- a/tests/Repository.py
+++ b/tests/Repository.py
@@ -134,6 +134,7 @@ def testEditWithAllArguments(self):
             has_projects=False,
             has_wiki=False,
             has_downloads=True,
+            allow_auto_merge=True,
             allow_forking=True,
             allow_update_branch=True,
             allow_squash_merge=True,
@@ -152,6 +153,7 @@ def testEditWithAllArguments(self):
         self.assertFalse(self.repo.has_projects)
         self.assertFalse(self.repo.has_wiki)
         self.assertTrue(self.repo.has_downloads)
+        self.assertTrue(self.repo.allow_auto_merge)
         self.assertTrue(self.repo.allow_forking)
         self.assertTrue(self.repo.allow_squash_merge)
         self.assertTrue(self.repo.allow_merge_commit)