8000 [ez][trymerge] Edit revert message for reverted ghstack PRs (#153573) · pytorch/pytorch@00e5cb3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 00e5cb3

Browse files
clee2000pytorchmergebot
authored andcommitted
[ez][trymerge] Edit revert message for reverted ghstack PRs (#153573)
Change comment about successful revert so it also contains info about the original PR that got the comment (if it is a ghstacked PR) Pull Request resolved: #153573 Approved by: https://github.com/atalman, https://github.com/malfet
1 parent 480ae2d commit 00e5cb3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/scripts/trymerge.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@ def get_ghstack_dependent_prs(
19381938

19391939
def do_revert_prs(
19401940
repo: GitRepo,
1941+
original_pr: GitHubPR,
19411942
shas_and_prs: list[tuple[str, GitHubPR]],
19421943
*,
19431944
author_login: str,
@@ -1959,9 +1960,16 @@ def do_revert_prs(
19591960

19601961
# Comment/reopen PRs
19611962
for commit_sha, pr in shas_and_prs:
1962-
revert_message = (
1963-
f"@{pr.get_pr_creator_login()} your PR has been successfully reverted."
1964-
)
1963+
revert_message = ""
1964+
if pr.pr_num == original_pr.pr_num:
1965+
revert_message += (
1966+
f"@{pr.get_pr_creator_login()} your PR has been successfully reverted."
1967+
)
1968+
else:
1969+
revert_message += (
1970+
f"@{pr.get_pr_creator_login()} your PR has been reverted as part of the stack under "
1971+
f"#{original_pr.pr_num}.\n"
1972+
)
19651973
if (
19661974
pr.has_internal_changes()
19671975
and not pr.has_no_connected_diff()
@@ -2013,6 +2021,7 @@ def try_revert(
20132021

20142022
do_revert_prs(
20152023
repo,
2024+
pr,
20162025
shas_and_prs,
20172026
author_login=author_login,
20182027
extra_msg=extra_msg,

0 commit comments

Comments
 (0)
0