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

Method create_git_commit

github/Repository.py:1427–1459  ·  view source on GitHub ↗

:calls: `POST /repos/{owner}/{repo}/git/commits `_ :param message: string :param tree: :class:`github.GitTree.GitTree` :param parents: list of :class:`github.GitCommit.GitCommit` :param author: :class:`gi

(
        self,
        message: str,
        tree: GitTree,
        parents: list[GitCommit],
        author: Opt[InputGitAuthor] = NotSet,
        committer: Opt[InputGitAuthor] = NotSet,
    )

Source from the content-addressed store, hash-verified

1425 return github.GitBlob.GitBlob(self._requester, headers, data, completed=True)
1426
1427 def create_git_commit(
1428 self,
1429 message: str,
1430 tree: GitTree,
1431 parents: list[GitCommit],
1432 author: Opt[InputGitAuthor] = NotSet,
1433 committer: Opt[InputGitAuthor] = NotSet,
1434 ) -> GitCommit:
1435 """
1436 :calls: `POST /repos/{owner}/{repo}/git/commits <https://docs.github.com/en/rest/reference/git#commits>`_
1437 :param message: string
1438 :param tree: :class:`github.GitTree.GitTree`
1439 :param parents: list of :class:`github.GitCommit.GitCommit`
1440 :param author: :class:`github.InputGitAuthor.InputGitAuthor`
1441 :param committer: :class:`github.InputGitAuthor.InputGitAuthor`
1442 :rtype: :class:`github.GitCommit.GitCommit`
1443 """
1444 assert isinstance(message, str), message
1445 assert isinstance(tree, github.GitTree.GitTree), tree
1446 assert all(isinstance(element, github.GitCommit.GitCommit) for element in parents), parents
1447 assert is_optional(author, github.InputGitAuthor), author
1448 assert is_optional(committer, github.InputGitAuthor), committer
1449 post_parameters: dict[str, Any] = {
1450 "message": message,
1451 "tree": tree._identity,
1452 "parents": [element._identity for element in parents],
1453 }
1454 if is_defined(author):
1455 post_parameters["author"] = author._identity
1456 if is_defined(committer):
1457 post_parameters["committer"] = committer._identity
1458 headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/git/commits", input=post_parameters)
1459 return github.GitCommit.GitCommit(self._requester, headers, data, completed=True)
1460
1461 def create_git_ref(self, ref: str, sha: str) -> GitRef:
1462 """

Calls 3

is_optionalFunction · 0.90
is_definedFunction · 0.90
requestJsonAndCheckMethod · 0.80

Tested by

no test coverage detected