Check that PR base is default branch in trymerge.py

I've verified this locally with dry run.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73715
Approved by: https://github.com/malfet
This commit is contained in:
Sergii Dymchenko
2022-03-09 00:11:26 +00:00
committed by PyTorch MergeBot
parent 1c152f800b
commit dc38326f1d

View File

@ -350,6 +350,8 @@ class GitHubPR:
repo.amend_commit_message(msg)
def merge_into(self, repo: GitRepo, dry_run: bool = False) -> None:
if self.base_ref() != self.default_branch():
raise RuntimeError("Not a pull request into default branch.")
# Raises exception if matching rule is not found
find_matching_merge_rule(self, repo)
if repo.current_branch() != self.default_branch():