@@ -50,30 +50,32 @@ def main():
50
50
run_id = args .run_id
51
51
52
52
report = ""
53
+ comment_id = get_comment_id (token , pr_number , COMMENT_HIDDEN_IDENTIFIER )
53
54
if stage == STAGES_PROGRESS :
54
- report = COMMENT_HIDDEN_IDENTIFIER
55
- report += generate_markdown_title (TITLE_PROGESS , commit , run_id )
56
- delete_label (token , pr_number , PR_LABEL )
55
+ if comment_id :
56
+ report = COMMENT_HIDDEN_IDENTIFIER
57
+ report += generate_markdown_title (TITLE_PROGESS , commit , run_id )
58
+ update_comment (token , comment_id , report )
59
+ delete_label (token , pr_number , PR_LABEL )
57
60
elif stage == STAGES_END :
58
61
diff_report_file = os .path .join (os .path .expanduser (args .report ),
59
62
api_diff_report .API_DIFF_FILE_NAME )
60
63
with open (diff_report_file , 'r' ) as file :
61
64
report_content = file .read ()
62
- if report_content :
65
+ if report_content : # Diff detected
63
66
report = COMMENT_HIDDEN_IDENTIFIER + generate_markdown_title (
64
67
TITLE_END_DIFF , commit , run_id ) + report_content
68
+ if comment_id :
69
+ update_comment (token , comment_id , report )
70
+ else :
71
+ add_comment (token , pr_number , report )
65
72
add_label (token , pr_number , PR_LABEL )
66
- else :
67
- report = COMMENT_HIDDEN_IDENTIFIER + generate_markdown_title (
68
- TITLE_END_NO_DIFF , commit , run_id )
69
- delete_label (token , pr_number , PR_LABEL )
70
-
71
- if report :
72
- comment_id = get_comment_id (token , pr_number , COMMENT_HIDDEN_IDENTIFIER )
73
- if not comment_id :
74
- add_comment (token , pr_number , report )
75
- else :
76
- update_comment (token , comment_id , report )
73
+ else : # No diff
74
+ if comment_id :
75
+ report = COMMENT_HIDDEN_IDENTIFIER + generate_markdown_title (
76
+ TITLE_END_NO_DIFF , commit , run_id )
77
+ update_comment (token , comment_id , report )
78
+ delete_label (token , pr_number , PR_LABEL )
77
79
78
80
79
81
def generate_markdown_title (title , commit , run_id ):
0 commit comments