Skip to content

Commit 33a117c

Browse files
pytorchmergebotswang392
authored andcommitted
Revert "[mergebot] Add all-green option (#77660)"
This reverts commit 340c412. Reverted #77660 on behalf of https://github.com/malfet due to as it broke lint, see https://github.com/pytorch/pytorch/runs/6532480582?check_suite_focus=true
1 parent d8a73f5 commit 33a117c

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

.github/scripts/trymerge.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ def parse_args() -> Any:
384384
parser = ArgumentParser("Merge PR into default branch")
385385
parser.add_argument("--dry-run", action="store_true")
386386
parser.add_argument("--on-green", action="store_true")
387-
parser.add_argument("--all-green", action="store_true")
388387
parser.add_argument("--revert", action="store_true")
389388
parser.add_argument("--force", action="store_true")
390389
parser.add_argument("--comment-id", type=int)
@@ -888,7 +887,7 @@ def prefix_with_github_url(suffix_str: str) -> str:
888887
return f"https://github.com/{suffix_str}"
889888

890889

891-
def merge_on_green(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_minutes: int = 400, all_green: bool = False) -> None:
890+
def merge_on_green(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_minutes: int = 400) -> None:
892891
repo = GitRepo(get_git_repo_dir(), get_git_remote_name())
893892
org, project = repo.gh_owner_and_name()
894893
start_time = time.time()
@@ -898,25 +897,10 @@ def merge_on_green(pr_num: int, repo: GitRepo, dry_run: bool = False, timeout_mi
898897
current_time = time.time()
899898
elapsed_time = current_time - start_time
900899

900+
901901
pr = GitHubPR(org, project, pr_num)
902902
try:
903-
if all_green:
904-
checks = pr.get_checkrun_conclusions()
905-
pending_checks = []
906-
failed_checks = []
907-
for check in checks:
908-
if checks[check] is None:
909-
pending_checks.append(check)
910-
elif checks[check] != 'SUCCESS':
911-
failed_checks.append(check)
912-
if len(failed_checks) > 0:
913-
raise RuntimeError(f"Failed to merge due to failing checks, {','.join(failed_checks)}")
914-
if len(pending_checks) > 0:
915-
reject_reason = f"Refusing to merge as mandatory check(s) {','.join(pending_checks)} are missing"
916-
raise MandatoryChecksMissingError(reject_reason)
917-
pr.merge_into(repo, dry_run=dry_run)
918-
else:
919-
pr.merge_into(repo, dry_run=dry_run)
903+
return pr.merge_into(repo, dry_run=dry_run)
920904
except MandatoryChecksMissingError as ex:
921905
last_exception = str(ex)
922906
print(f"Merged failed due to: {ex}. Retrying in 60 seconds.")
@@ -958,9 +942,9 @@ def handle_exception(e: Exception, msg: str = "Merge failed") -> None:
958942
gh_post_comment(org, project, args.pr_num, "Cross-repo ghstack merges are not supported", dry_run=args.dry_run)
959943
return
960944

961-
if args.on_green or args._all_green:
945+
if args.on_green:
962946
try:
963-
merge_on_green(args.pr_num, repo, dry_run=args.dry_run, all_green=args.all_green)
947+
merge_on_green(args.pr_num, repo, dry_run=args.dry_run)
964948
except Exception as e:
965949
handle_exception(e)
966950
else:

0 commit comments

Comments
 (0)