Skip to content

Commit

Permalink
implement Pull.reopen
Browse files Browse the repository at this point in the history
Mutation.reopenPullRequest field
  • Loading branch information
ShineyDev committed Feb 17, 2025
1 parent f234575 commit 64c7dc7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 deletions github/core/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,21 @@ async def mutate_pull_close(

return data # type: ignore

async def mutate_pull_reopen(
self,
/,
pull_id: str,
*,
fields: Iterable[str] = MISSING,
) -> PullData:
fields = ("__typename",) if fields is MISSING else fields
query = "mutation($pull_id:ID!,$mutation_id:String!){reopenPullRequest(input:{clientMutationId:$mutation_id,pullRequestId:$pull_id}){pullRequest{%s}}}" % ",".join(fields)
path = ("reopenPullRequest", "pullRequest")

data = await self._mutate(query, *path, pull_id=pull_id)

return data # type: ignore

async def mutate_reactable_add_reaction(
self,
/,
Expand Down
25 changes: 25 additions & 0 deletions github/repository/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,31 @@ async def close(
self._data["closed"] = data["closed"]
self._data["state"] = data["state"]

async def reopen(
self,
/,
) -> None:
"""
|coro|
Reopens the pull request.
.. note::
Use of this mutation will also update the following fields:
- :attr:`~.is_closed`
- :attr:`~.closed_reason`
"""

data = await self._http.mutate_pull_reopen(
self.id,
fields=("closed", "state"),
)

self._data["closed"] = data["closed"]
self._data["state"] = data["state"]


__all__ = [
"Pull",
Expand Down

0 comments on commit 64c7dc7

Please sign in to comment.