mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
fix bug in print test stats
Apparently GIT_DEFAULT_BRACH can be empty, it looks like `github.event.repository.default_branch` is not populated for schedule-triggered workflows Pull Request resolved: https://github.com/pytorch/pytorch/pull/74349 Approved by: https://github.com/seemethere, https://github.com/janeyx99
This commit is contained in:
parent
b604314aa6
commit
e1d2d3f480
1 changed files with 7 additions and 2 deletions
|
|
@ -107,9 +107,14 @@ def plural(n: int) -> str:
|
|||
|
||||
|
||||
def get_base_commit(sha1: str) -> str:
|
||||
default_branch = f"origin/{os.environ.get('GIT_DEFAULT_BRANCH', 'master')}"
|
||||
default_branch = os.environ.get('GIT_DEFAULT_BRANCH')
|
||||
# capture None and "" cases
|
||||
if not default_branch:
|
||||
default_branch = "master"
|
||||
|
||||
default_remote = f"origin/{default_branch}"
|
||||
return subprocess.check_output(
|
||||
["git", "merge-base", sha1, default_branch],
|
||||
["git", "merge-base", sha1, default_remote],
|
||||
encoding="ascii",
|
||||
).strip()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue