MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / create_fork

Method create_fork

github/Repository.py:2991–3022  ·  view source on GitHub ↗

:calls: `POST /repos/{owner}/{repo}/forks `_ :param organization: :class:`github.Organization.Organization` or string :param name: string :param default_branch_only: bool :rtype: :class:`github.Repository

(
        self,
        organization: Organization | Opt[str] = NotSet,
        name: Opt[str] = NotSet,
        default_branch_only: Opt[bool] = NotSet,
    )

Source from the content-addressed store, hash-verified

2989 return PaginatedList(Repository, self._requester, f"{self.url}/forks", None)
2990
2991 def create_fork(
2992 self,
2993 organization: Organization | Opt[str] = NotSet,
2994 name: Opt[str] = NotSet,
2995 default_branch_only: Opt[bool] = NotSet,
2996 ) -> Repository:
2997 """
2998 :calls: `POST /repos/{owner}/{repo}/forks <https://docs.github.com/en/rest/reference/repos#forks>`_
2999 :param organization: :class:`github.Organization.Organization` or string
3000 :param name: string
3001 :param default_branch_only: bool
3002 :rtype: :class:`github.Repository.Repository`
3003 """
3004 post_parameters: dict[str, Any] = {}
3005 if isinstance(organization, github.Organization.Organization):
3006 post_parameters["organization"] = organization.login
3007 elif isinstance(organization, str):
3008 post_parameters["organization"] = organization
3009 else:
3010 assert is_undefined(organization), organization
3011 assert is_optional(name, str), name
3012 assert is_optional(default_branch_only, bool), default_branch_only
3013 if is_defined(name):
3014 post_parameters["name"] = name
3015 if is_defined(default_branch_only):
3016 post_parameters["default_branch_only"] = default_branch_only
3017 headers, data = self._requester.requestJsonAndCheck(
3018 "POST",
3019 f"{self.url}/forks",
3020 input=post_parameters,
3021 )
3022 return Repository(self._requester, headers, data, completed=True)
3023
3024 def get_git_blob(self, sha: str) -> GitBlob:
3025 """

Callers

nothing calls this directly

Calls 5

is_undefinedFunction · 0.90
is_optionalFunction · 0.90
is_definedFunction · 0.90
requestJsonAndCheckMethod · 0.80
RepositoryClass · 0.70

Tested by

no test coverage detected