@@ -31,22 +31,11 @@ def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> int | N
3131def get_comment (
3232 github_token : str ,
3333 pr_number : int ,
34- junit_objects ,
35- ninja_logs ,
36- advisor_response ,
37- return_code ,
34+ body : str ,
3835) -> dict [str , str ]:
3936 repo = github .Github (github_token ).get_repo ("llvm/llvm-project" )
4037 pr = repo .get_issue (pr_number ).as_pull_request ()
41- comment = {
42- "body" : generate_test_report_lib .generate_report (
43- generate_test_report_lib .compute_platform_title (),
44- return_code ,
45- junit_objects ,
46- ninja_logs ,
47- failure_explanations_list = advisor_response ,
48- )
49- }
38+ comment = {"body" : body }
5039 comment_id = get_comment_id (platform .system (), pr )
5140 if comment_id :
5241 comment ["id" ] = comment_id
@@ -59,6 +48,14 @@ def main(
5948 pr_number : int ,
6049 return_code : int ,
6150):
51+ if return_code == 0 :
52+ with open ("comment" , "w" ) as comment_file_handle :
53+ comment = get_comment (
54+ ":white_check_mark: With the latest revision this PR passed "
55+ "the premerge checks."
56+ )
57+ if comment ["id" ]:
58+ json .dump ([comment ], comment_file_handle )
6259 junit_objects , ninja_logs = generate_test_report_lib .load_info_from_files (
6360 build_log_files
6461 )
@@ -90,10 +87,13 @@ def main(
9087 get_comment (
9188 github_token ,
9289 pr_number ,
93- junit_objects ,
94- ninja_logs ,
95- advisor_response .json (),
96- return_code ,
90+ generate_test_report_lib .generate_report (
91+ generate_test_report_lib .compute_platform_title (),
92+ return_code ,
93+ junit_objects ,
94+ ninja_logs ,
95+ failure_explanations_list = advisor_response .json (),
96+ ),
9797 )
9898 ]
9999 with open ("comment" , "w" ) as comment_file_handle :
0 commit comments