mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[trymerge] Manually close merged PR when Github fails (#135890)
Manually close merged PR when Github fails to do it. Consequences of current design: Sleeping for 1 min uses up the machine, might result in race conditions, results in merging label to removed a bit later, pr still left open if this api fails too (ie no async clean up job) Tested in https://github.com/malfet/deleteme/pull/92 by removing the part of the commit message that has "resolved #pr num" Pull Request resolved: https://github.com/pytorch/pytorch/pull/135890 Approved by: https://github.com/malfet, https://github.com/huydhn
This commit is contained in:
committed by
PyTorch MergeBot
parent
7834c0bb2c
commit
bc0f330169
8
.github/scripts/github_utils.py
vendored
8
.github/scripts/github_utils.py
vendored
@ -168,6 +168,14 @@ def gh_post_commit_comment(
|
||||
)
|
||||
|
||||
|
||||
def gh_close_pr(org: str, repo: str, pr_num: int, dry_run: bool = False) -> None:
|
||||
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/pulls/{pr_num}"
|
||||
if dry_run:
|
||||
print(f"Dry run closing PR {pr_num}")
|
||||
else:
|
||||
gh_fetch_url(url, method="PATCH", data={"state": "closed"})
|
||||
|
||||
|
||||
def gh_delete_comment(org: str, repo: str, comment_id: int) -> None:
|
||||
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/comments/{comment_id}"
|
||||
gh_fetch_url(url, method="DELETE")
|
||||
|
Reference in New Issue
Block a user