4747from absl import flags
4848from absl import logging
4949
50- import github
50+ import firebase_github
5151import summarize_test_results as summarize
5252
5353_REPORT_LABEL = "nightly-testing"
144144
145145def test_start (token , issue_number , actor , commit , run_id ):
146146 """In PR, when start testing, add comment and label \" tests: in-progress\" """
147- github .add_label (token , issue_number , _LABEL_PROGRESS )
147+ firebase_github .add_label (token , issue_number , _LABEL_PROGRESS )
148148 for label in [_LABEL_TRIGGER_FULL , _LABEL_TRIGGER_QUICK , _LABEL_FAILED , _LABEL_SUCCEED ]:
149- github .delete_label (token , issue_number , label )
149+ firebase_github .delete_label (token , issue_number , label )
150150
151151 comment = (_COMMENT_TITLE_PROGESS +
152152 _get_description (actor , commit , run_id ) +
@@ -168,7 +168,7 @@ def test_progress(token, issue_number, actor, commit, run_id):
168168 else :
169169 # failures/errors still exist after retry
170170 title = _COMMENT_TITLE_PROGESS_FAIL
171- github .add_label (token , issue_number , _LABEL_FAILED )
171+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
172172 comment = (title +
173173 _get_description (actor , commit , run_id ) +
174174 log_summary +
@@ -184,7 +184,7 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
184184 success_or_only_flakiness , log_summary = _get_summary_table (token , run_id )
185185 if success_or_only_flakiness and not log_summary :
186186 # succeeded (without flakiness)
187- github .add_label (token , issue_number , _LABEL_SUCCEED )
187+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
188188 comment = (_COMMENT_TITLE_SUCCEED +
189189 _get_description (actor , commit , run_id ) +
190190 _COMMENT_HIDDEN_DIVIDER )
@@ -193,19 +193,19 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
193193 if success_or_only_flakiness :
194194 # all failures/errors are due to flakiness (succeeded after retry)
195195 title = _COMMENT_TITLE_FLAKY
196- github .add_label (token , issue_number , _LABEL_SUCCEED )
196+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
197197 else :
198198 # failures/errors still exist after retry
199199 title = _COMMENT_TITLE_FAIL
200- github .add_label (token , issue_number , _LABEL_FAILED )
200+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
201201 comment = (title +
202202 _get_description (actor , commit , run_id ) +
203203 log_summary +
204204 _COMMENT_FLAKY_TRACKER +
205205 _COMMENT_HIDDEN_DIVIDER )
206206 _update_comment (token , issue_number , comment )
207207
208- github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
208+ firebase_github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
209209
210210
211211def test_report (token , actor , commit , run_id , build_against , build_apis ):
@@ -232,7 +232,7 @@ def test_report(token, actor, commit, run_id, build_against, build_apis):
232232 prefix = "Note: This report excludes Firestore. Please also check **[the report for Firestore](%s).**\n ***\n " % firestore_issue_url
233233
234234 issue_number = _get_issue_number (token , report_title , _REPORT_LABEL )
235- previous_comment = github .get_issue_body (token , issue_number )
235+ previous_comment = firebase_github .get_issue_body (token , issue_number )
236236 [previous_prefix , previous_comment_repo , previous_comment_sdk ,
237237 previous_comment_tip ] = previous_comment .split (_COMMENT_HIDDEN_DIVIDER )
238238 logging .info ("Previous prefix: %s" , previous_prefix )
@@ -284,15 +284,15 @@ def test_report(token, actor, commit, run_id, build_against, build_apis):
284284 comment = prefix + _COMMENT_HIDDEN_DIVIDER + previous_comment_repo + _COMMENT_HIDDEN_DIVIDER + previous_comment_sdk + _COMMENT_HIDDEN_DIVIDER + comment
285285
286286 if (_COMMENT_TITLE_SUCCEED_REPO in comment ) and (_COMMENT_TITLE_SUCCEED_SDK in comment ) and (build_apis != _BUILD_API_FIRESTORE or _COMMENT_TITLE_SUCCEED_TIP in comment ):
287- github .close_issue (token , issue_number )
287+ firebase_github .close_issue (token , issue_number )
288288 else :
289- github .open_issue (token , issue_number )
289+ firebase_github .open_issue (token , issue_number )
290290
291- github .update_issue_comment (token , issue_number , comment )
291+ firebase_github .update_issue_comment (token , issue_number , comment )
292292
293293
294294def _get_issue_number (token , title , label ):
295- issues = github .search_issues_by_label (label )
295+ issues = firebase_github .search_issues_by_label (label )
296296 for issue in issues :
297297 if issue ["title" ] == title :
298298 return issue ["number" ]
@@ -303,19 +303,19 @@ def _get_issue_number(token, title, label):
303303 _COMMENT_HIDDEN_DIVIDER + " " +
304304 _COMMENT_HIDDEN_DIVIDER + " "
305305 )
306- return github .create_issue (token , title , label , empty_comment )["number" ]
306+ return firebase_github .create_issue (token , title , label , empty_comment )["number" ]
307307
308308
309309def _update_comment (token , issue_number , comment ):
310310 comment_id = _get_comment_id (token , issue_number , _COMMENT_HIDDEN_DIVIDER )
311311 if not comment_id :
312- github .add_comment (token , issue_number , comment )
312+ firebase_github .add_comment (token , issue_number , comment )
313313 else :
314- github .update_comment (token , comment_id , comment )
314+ firebase_github .update_comment (token , comment_id , comment )
315315
316316
317317def _get_comment_id (token , issue_number , comment_identifier ):
318- comments = github .list_comments (token , issue_number )
318+ comments = firebase_github .list_comments (token , issue_number )
319319 for comment in comments :
320320 if comment_identifier in comment ['body' ]:
321321 return comment ['id' ]
@@ -342,7 +342,7 @@ def _get_summary_table(token, run_id):
342342
343343
344344def _get_artifact_id (token , run_id , name ):
345- artifacts = github .list_artifacts (token , run_id )
345+ artifacts = firebase_github .list_artifacts (token , run_id )
346346 for artifact in artifacts :
347347 if artifact ["name" ] == name :
348348 return artifact ["id" ]
0 commit comments