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

Method create_issue

github/Repository.py:1682–1731  ·  view source on GitHub ↗

:calls: `POST /repos/{owner}/{repo}/issues `_ :param title: string :param body: string :param assignee: string or :class:`github.NamedUser.NamedUser` :param assignees: list of string or :class:`github.NamedUse

(
        self,
        title: str,
        body: Opt[str] = NotSet,
        assignee: NamedUser | Opt[str] = NotSet,
        milestone: Opt[Milestone] = NotSet,
        labels: list[Label] | Opt[list[str]] = NotSet,
        assignees: Opt[list[str]] | list[NamedUser] = NotSet,
    )

Source from the content-addressed store, hash-verified

1680 return github.Hook.Hook(self._requester, headers, data, completed=True)
1681
1682 def create_issue(
1683 self,
1684 title: str,
1685 body: Opt[str] = NotSet,
1686 assignee: NamedUser | Opt[str] = NotSet,
1687 milestone: Opt[Milestone] = NotSet,
1688 labels: list[Label] | Opt[list[str]] = NotSet,
1689 assignees: Opt[list[str]] | list[NamedUser] = NotSet,
1690 ) -> Issue:
1691 """
1692 :calls: `POST /repos/{owner}/{repo}/issues <https://docs.github.com/en/rest/reference/issues>`_
1693 :param title: string
1694 :param body: string
1695 :param assignee: string or :class:`github.NamedUser.NamedUser`
1696 :param assignees: list of string or :class:`github.NamedUser.NamedUser`
1697 :param milestone: :class:`github.Milestone.Milestone`
1698 :param labels: list of :class:`github.Label.Label`
1699 :rtype: :class:`github.Issue.Issue`
1700 """
1701 assert isinstance(title, str), title
1702 assert is_optional(body, str), body
1703 assert is_optional(assignee, (str, github.NamedUser.NamedUser)), assignee
1704 assert is_optional_list(assignees, (github.NamedUser.NamedUser, str)), assignees
1705 assert is_optional(milestone, github.Milestone.Milestone), milestone
1706 assert is_optional_list(labels, (github.Label.Label, str)), labels
1707
1708 post_parameters: dict[str, Any] = {
1709 "title": title,
1710 }
1711 if is_defined(body):
1712 post_parameters["body"] = body
1713 if is_defined(assignee):
1714 if isinstance(assignee, github.NamedUser.NamedUser):
1715 post_parameters["assignee"] = assignee._identity
1716 else:
1717 post_parameters["assignee"] = assignee
1718 if is_defined(assignees):
1719 post_parameters["assignees"] = [
1720 element._identity if isinstance(element, github.NamedUser.NamedUser) else element
1721 for element in assignees # type: ignore
1722 ]
1723 if is_defined(milestone):
1724 post_parameters["milestone"] = milestone._identity
1725 if is_defined(labels):
1726 post_parameters["labels"] = [
1727 element.name if isinstance(element, github.Label.Label) else element
1728 for element in labels # type: ignore
1729 ]
1730 headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/issues", input=post_parameters)
1731 return github.Issue.Issue(self._requester, headers, data, completed=True)
1732
1733 def create_key(self, title: str, key: str, read_only: bool = False) -> RepositoryKey:
1734 """

Calls 4

is_optionalFunction · 0.90
is_optional_listFunction · 0.90
is_definedFunction · 0.90
requestJsonAndCheckMethod · 0.80

Tested by

no test coverage detected