@@ -129,6 +129,7 @@ def fetch(self):
129129 if request .status_code == 200 :
130130 return request .json ()
131131 else :
132+ print (request .json ())
132133 raise Exception ("Query Failed: {}" .format (request .status_code ))
133134
134135
@@ -164,35 +165,40 @@ def get_commit_and_checksuite(query_commits):
164165 return [None , None ]
165166
166167
167- def append_runs_to_list (runs , list ):
168+ def append_runs_to_list (runs , bad_runs_by_matrix ):
168169 regex_matrix = re .compile ("^build-[^ ]+" )
169170 regex_board = re .compile ("\([^ ]+\)$" )
170171 for run in runs ["nodes" ]:
171172 name = run ["name" ]
172173 res_matrix = regex_matrix .search (name )
173174 if res_matrix :
174175 matrix = res_matrix .group ()
175- if matrix not in list :
176- list [matrix ] = []
177- list [matrix ].append (regex_board .search (name ).group ()[1 :- 1 ])
176+ if matrix not in bad_runs_by_matrix :
177+ bad_runs_by_matrix [matrix ] = []
178+ res_board = regex_board .search (name )
179+ if res_board :
180+ bad_runs_by_matrix [matrix ].append (res_board .group ()[1 :- 1 ])
178181
179182
180- def get_bad_checkruns (query_checkruns , list = {}):
181- checkruns = query_checkruns .fetch ()["data" ]["node" ]
182- run_types = ["failed" , "incomplete" ]
183- paginate = False
183+ def get_bad_checkruns (query_checkruns ):
184+ more_pages = True
185+ bad_runs_by_matrix = {}
186+ while more_pages :
187+ checkruns = query_checkruns .fetch ()["data" ]["node" ]
188+ run_types = ["failed" , "incomplete" ]
189+ more_pages = False
184190
185- for run_type in run_types :
186- run_type_camel = run_type .capitalize () + "Run"
187- run_type = run_type + "Runs"
191+ for run_type in run_types :
192+ run_type_camel = run_type .capitalize () + "Run"
193+ run_type = run_type + "Runs"
188194
189- append_runs_to_list (checkruns [run_type ], list )
195+ append_runs_to_list (checkruns [run_type ], bad_runs_by_matrix )
190196
191- if query_checkruns .paginate (checkruns [run_type ]["pageInfo" ], "after" + run_type_camel ):
192- query_checkruns .variables ["include" + run_type_camel ] = True
193- paginate = True
197+ if query_checkruns .paginate (checkruns [run_type ]["pageInfo" ], "after" + run_type_camel ):
198+ query_checkruns .variables ["include" + run_type_camel ] = True
199+ more_pages = True
194200
195- return get_bad_checkruns ( query_checkruns , list ) if paginate else list
201+ return bad_runs_by_matrix
196202
197203
198204def main ():
0 commit comments