[GHF] Validate graphql output (#83366)

If checkrun nodes are not instance of dictionary, skip them

Should prevent  https://github.com/pytorch/pytorch/pull/83215#issuecomment-1213617665 from happening in the future

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83366
Approved by: https://github.com/kit1980
This commit is contained in:
Nikita Shulga 2022-08-13 13:41:30 +00:00 committed by PyTorch MergeBot
parent f02f304657
commit 408fa38f33

View File

@ -508,6 +508,9 @@ def add_workflow_conclusions(
has_failing_check = False has_failing_check = False
while checkruns is not None: while checkruns is not None:
for checkrun_node in checkruns["nodes"]: for checkrun_node in checkruns["nodes"]:
if not isinstance(checkrun_node, dict):
warn(f"Expected dictionary, but got {type(checkrun_node)}")
continue
if checkrun_node["conclusion"] == 'FAILURE': if checkrun_node["conclusion"] == 'FAILURE':
has_failing_check = True has_failing_check = True
conclusions[f'{get_check_run_name_prefix(workflow_run)}{checkrun_node["name"]}'] = ( conclusions[f'{get_check_run_name_prefix(workflow_run)}{checkrun_node["name"]}'] = (