@@ -61,30 +61,41 @@ def comment_pr(repo, run_id):
61
61
62
62
# Try storing diff for previous run:
63
63
prev_run_id = 0
64
+ prev_diff_exists = False
64
65
try :
65
66
prev_run_id = get_previous_run_id (repo , run_id , pr_number )
66
67
prev_diff_folder = "prev_diff"
67
68
utils .download_artifact (repo , comparison_artifact_name ,
68
69
prev_diff_folder , prev_run_id )
69
70
71
+ prev_diff_exists = True
72
+
70
73
if filecmp .cmp (f"{ current_diff_folder } /{ comparison_artifact_file_name } " , f"{ prev_diff_folder } /{ comparison_artifact_file_name } " , shallow = False ):
71
74
print (
72
75
f"Previous run { prev_run_id } resulted in the same diff, so not commenting again." )
73
76
return
74
77
else :
75
78
print (f"Diff of previous run { prev_run_id } differs, commenting." )
76
79
except Exception :
77
- # this is not mecessarily a failure, it can also mean that there was no previous run yet.
80
+ # this is not necessarily a failure, it can also mean that there was no previous run yet.
78
81
print ("Couldn't generate diff for previous run:" , sys .exc_info ()[1 ])
79
82
80
83
comment = get_comment_text (
81
84
f"{ current_diff_folder } /{ comparison_artifact_file_name } " , repo , run_id )
82
85
83
86
if comment == None :
84
87
if prev_run_id == 0 :
85
- print ("Nothing to comment." )
88
+ print (
89
+ "Nothing to comment. There's no previous run, and there's no coverage change." )
86
90
return
91
+
87
92
print ("Previous run found, and current run removes coverage change." )
93
+
94
+ if not prev_diff_exists :
95
+ print (
96
+ "Couldn't get the comparison artifact from previous run. Not commenting." )
97
+ return
98
+
88
99
comment = comment_first_line + \
89
100
"A recent commit removed the previously reported differences."
90
101
post_comment (comment , repo , pr_number )
0 commit comments