mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[mergebot] Fix Land Checks validation (#80907)
Before, it was landing it because at the beginning there's no checks queued and it was checking the length of the object. Test Plan: Tested it with a land check commit (Both Success and Fail): ``` (base) kerryz@kerryz-mbp pytorch % /Users/kerryz/miniconda3/bin/python /Users/kerryz/pytorch/.github/scripts/testtrymerge.py (base) kerryz@kerryz-mbp pytorch % /Users/kerryz/miniconda3/bin/python /Users/kerryz/pytorch/.github/scripts/testtrymerge.py Traceback (most recent call last): File "/Users/kerryz/pytorch/.github/scripts/testtrymerge.py", line 14, in <module> validate_land_time_checks(repo, "fc636aa0c359ebee9a70527534007f8ac37ba501") File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 1007, in validate_land_time_checks raise MandatoryChecksMissingError(f"Refusing to merge as land check(s) {checks_to_str(pending_checks)} are not yet run") trymerge.MandatoryChecksMissingError: Refusing to merge as land check(s) [macos-11-py3-x86-64 / test (default, 1, 2, macos-12)](https://github.com/pytorch/pytorch/runs/7202200731?check_suite_focus=true), [linux-bionic-cuda10.2-py3.9-gcc7 / test (slow, 1, 1, linux.4xlarge.nvidia.gpu)](https://github.com/pytorch/pytorch/runs/7201784661?check_suite_focus=true), [linux-bionic-cuda10.2-py3.9-gcc7 / test (default, 1, 2, linux.4xlarge.nvidia.gpu)](https://github.com/pytorch/pytorch/runs/7201784432?check_suite_focus=true) are not yet run ``` Tested it with a normal commit that doesn't have any checks associated with it: ``` (base) kerryz@kerryz-mbp pytorch % /Users/kerryz/miniconda3/bin/python /Users/kerryz/pytorch/.github/scripts/testtrymerge.py Traceback (most recent call last): File "/Users/kerryz/pytorch/.github/scripts/testtrymerge.py", line 14, in <module> validate_land_time_checks(repo, "d46f36a3ea227b756bd82901948d8ac203435e46") File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 1001, in validate_land_time_checks checks = fetch_check_run_conclusions(repo, commit) File "/Users/kerryz/pytorch/.github/scripts/trymerge.py", line 994, in fetch_check_run_conclusions raise MandatoryChecksMissingError("Refusing to merge as land check(s) are not yet run") trymerge.MandatoryChecksMissingError: Refusing to merge as land check(s) are not yet run ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/80907 Approved by: https://github.com/janeyx99
This commit is contained in:
committed by
PyTorch MergeBot
parent
d9ff56ccc0
commit
1d4dbdcefe
2
.github/scripts/trymerge.py
vendored
2
.github/scripts/trymerge.py
vendored
@ -990,7 +990,7 @@ def fetch_check_run_conclusions(repo: GitRepo, commit: str) -> Dict[str, Tuple[s
|
||||
[owner, name] = repo.gh_owner_and_name()
|
||||
checks = fetch_json_dict(f'https://api.github.com/repos/{owner}/{name}/commits/{commit}/check-runs')
|
||||
check_run_conclusions = {}
|
||||
if len(checks) == 0:
|
||||
if len(checks['check_runs']) == 0:
|
||||
raise MandatoryChecksMissingError("Refusing to merge as land check(s) are not yet run")
|
||||
for check_run in checks['check_runs']:
|
||||
check_run_conclusions[check_run['name']] = (check_run['conclusion'],
|
||||
|
Reference in New Issue
Block a user