mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Add new create_fork arguments (#2493)
Adds support for new `create_fork` arguments: - `name` - To set the name of the fork on creation - `default_branch_only` - To only include the default branch Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
This commit is contained in:
@@ -495,18 +495,24 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
self._requester, headers, data, completed=True
|
||||
)
|
||||
|
||||
def create_fork(self, repo):
|
||||
@staticmethod
|
||||
def create_fork(
|
||||
repo,
|
||||
name=github.GithubObject.NotSet,
|
||||
default_branch_only=github.GithubObject.NotSet,
|
||||
):
|
||||
"""
|
||||
:calls: `POST /repos/{owner}/{repo}/forks <http://docs.github.com/en/rest/reference/repos#forks>`_
|
||||
:param repo: :class:`github.Repository.Repository`
|
||||
:param name: string
|
||||
:param default_branch_only: bool
|
||||
:rtype: :class:`github.Repository.Repository`
|
||||
"""
|
||||
assert isinstance(repo, github.Repository.Repository), repo
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST", f"/repos/{repo.owner.login}/{repo.name}/forks"
|
||||
)
|
||||
return github.Repository.Repository(
|
||||
self._requester, headers, data, completed=True
|
||||
return repo.create_fork(
|
||||
organization=github.GithubObject.NotSet,
|
||||
name=name,
|
||||
default_branch_only=default_branch_only,
|
||||
)
|
||||
|
||||
def create_repo_from_template(
|
||||
|
||||
Reference in New Issue
Block a user