[BE][GHF] Do not hardcode default branch name (#118530)

Instead rely on `GitHubPR.default_branch()` which is the name of the repo's default branch.

Do not pass branch name `merge_changes` is called, as it is set to default branch inside the function

Pull Request resolved: https://github.com/pytorch/pytorch/pull/118530
Approved by: https://github.com/clee2000
This commit is contained in:
Nikita Shulga
2024-01-29 17:18:23 +00:00
committed by PyTorch MergeBot
parent 65f8276bc6
commit 3011a4406f

View File

@ -748,7 +748,7 @@ class GitHubPR:
# work for ghstack where the base is the custom branch, i.e. gh/USER/ID/base,
# so let's just use main instead
self.merge_base = gh_fetch_merge_base(
self.org, self.project, last_commit_oid, "main"
self.org, self.project, last_commit_oid, self.default_branch()
)
# Fallback to baseRefOid if the API call fails, i.e. rate limit. Note that baseRefOid
@ -2307,7 +2307,6 @@ def main() -> None:
get_ghstack_prs(repo, pr) # raises error if out of sync
pr.merge_changes(
repo,
branch="main",
skip_mandatory_checks=True,
skip_all_rule_checks=True,
)