39
39
}
40
40
"""
41
41
42
- QUERY_CHECKRUNS = """
42
+ QUERY_CHECK_RUNS = """
43
43
query ($checkSuiteID: ID!,
44
44
$afterFailedRun: String, $afterIncompleteRun: String,
45
45
$includeFailedRuns: Boolean!, $includeIncompleteRuns: Boolean!) {
92
92
}
93
93
94
94
95
- query_variables_checkruns = {
95
+ query_variables_check_runs = {
96
96
"checkSuiteID" : "" ,
97
97
"afterFailedRun" : None ,
98
98
"afterIncompleteRun" : None ,
@@ -141,7 +141,7 @@ def set_output(name, value):
141
141
print (f"Would set GitHub actions output { name } to '{ value } '" )
142
142
143
143
144
- def get_commit_and_checksuite (query_commits ):
144
+ def get_commit_and_check_suite (query_commits ):
145
145
commits = query_commits .fetch ()["data" ]["repository" ]["pullRequest" ]["commits" ]
146
146
147
147
if commits ["totalCount" ] > 0 :
@@ -150,17 +150,17 @@ def get_commit_and_checksuite(query_commits):
150
150
commit_sha = commit ["oid" ]
151
151
if commit_sha == os .environ ["EXCLUDE_COMMIT" ]:
152
152
continue
153
- checksuites = commit ["checkSuites" ]
154
- if checksuites ["totalCount" ] > 0 :
155
- for checksuite in checksuites ["nodes" ]:
156
- if checksuite ["workflowRun" ]["workflow" ]["name" ] == "Build CI" :
153
+ check_suites = commit ["checkSuites" ]
154
+ if check_suites ["totalCount" ] > 0 :
155
+ for check_suite in check_suites ["nodes" ]:
156
+ if check_suite ["workflowRun" ]["workflow" ]["name" ] == "Build CI" :
157
157
return [
158
158
commit_sha ,
159
- checksuite ["id" ] if checksuite ["conclusion" ] != "SUCCESS" else None ,
159
+ check_suite ["id" ] if check_suite ["conclusion" ] != "SUCCESS" else None ,
160
160
]
161
161
else :
162
162
if query_commits .paginate (commits ["pageInfo" ], "beforeCommit" ):
163
- return get_commit_and_checksuite (query_commits )
163
+ return get_commit_and_check_suite (query_commits )
164
164
165
165
return [None , None ]
166
166
@@ -180,22 +180,22 @@ def append_runs_to_list(runs, bad_runs_by_matrix):
180
180
bad_runs_by_matrix [matrix ].append (res_board .group ()[1 :- 1 ])
181
181
182
182
183
- def get_bad_checkruns ( query_checkruns ):
183
+ def get_bad_check_runs ( query_check_runs ):
184
184
more_pages = True
185
185
bad_runs_by_matrix = {}
186
186
while more_pages :
187
- checkruns = query_checkruns .fetch ()["data" ]["node" ]
187
+ check_runs = query_check_runs .fetch ()["data" ]["node" ]
188
188
run_types = ["failed" , "incomplete" ]
189
189
more_pages = False
190
190
191
191
for run_type in run_types :
192
192
run_type_camel = run_type .capitalize () + "Run"
193
193
run_type = run_type + "Runs"
194
194
195
- append_runs_to_list (checkruns [run_type ], bad_runs_by_matrix )
195
+ append_runs_to_list (check_runs [run_type ], bad_runs_by_matrix )
196
196
197
- if query_checkruns .paginate (checkruns [run_type ]["pageInfo" ], "after" + run_type_camel ):
198
- query_checkruns .variables ["include" + run_type_camel ] = True
197
+ if query_check_runs .paginate (check_runs [run_type ]["pageInfo" ], "after" + run_type_camel ):
198
+ query_check_runs .variables ["include" + run_type_camel ] = True
199
199
more_pages = True
200
200
201
201
return bad_runs_by_matrix
@@ -207,26 +207,26 @@ def main():
207
207
"/"
208
208
)
209
209
210
- commit , checksuite = get_commit_and_checksuite (query_commits )
210
+ commit , check_suite = get_commit_and_check_suite (query_commits )
211
211
212
- if checksuite is None :
212
+ if check_suite is None :
213
213
if commit is None :
214
- print ("No checkSuites found -> Abort " )
214
+ print ("Abort: No check suite found " )
215
215
else :
216
216
set_output ("commit" , commit )
217
217
quit ()
218
218
219
- query_checkruns = Query (QUERY_CHECKRUNS , query_variables_checkruns , headers )
220
- query_checkruns .variables ["checkSuiteID" ] = checksuite
219
+ query_check_runs = Query (QUERY_CHECK_RUNS , query_variables_check_runs , headers )
220
+ query_check_runs .variables ["checkSuiteID" ] = check_suite
221
221
222
- checkruns = get_bad_checkruns ( query_checkruns )
222
+ check_runs = get_bad_check_runs ( query_check_runs )
223
223
224
- if len (checkruns ) == 0 :
225
- print ("No checkRuns found -> Abort " )
224
+ if len (check_runs ) == 0 :
225
+ print ("Abort: No check runs found " )
226
226
quit ()
227
227
228
228
set_output ("commit" , commit )
229
- set_output ("checkruns " , json .dumps (checkruns ))
229
+ set_output ("check_runs " , json .dumps (check_runs ))
230
230
231
231
232
232
if __name__ == "__main__" :
0 commit comments