@@ -145,20 +145,33 @@ def merge_topics(self, reviews):
145145 return topics
146146
147147 def create_pr_review_text (self , topics ):
148- markdown_output = "## Code Review\n \n "
149-
148+ markdown_title = "## Code Review\n \n "
149+ markdown_output = ""
150+ high_ranked_issues = 0
150151 for topic , reviews in topics .items ():
151- markdown_output += f"### { topic } \n \n "
152- for review in reviews :
153- ct = output .PR_COLLAPSIBLE_TEMPLATE .format (
154- comment = review .get ("comment" , "NA" ),
155- reasoning = review .get ("reasoning" , "NA" ),
156- solution = review .get ("solution" , "NA" ),
157- confidence = review .get ("confidence" , "NA" ),
158- start_line = review .get ("start_line" , "NA" ),
159- end_line = review .get ("end_line" , "NA" ),
160- file_name = review .get ("file_name" , "NA" ),
161- )
162- markdown_output += ct + "\n "
163-
164- return markdown_output
152+ if len (reviews ) > 0 :
153+ markdown_output += f"### { topic } \n \n "
154+ for review in reviews :
155+ if review .get ("confidence" , "" ) == "critical" :
156+ high_ranked_issues += 1
157+ ct = output .PR_COLLAPSIBLE_TEMPLATE .format (
158+ comment = review .get ("comment" , "NA" ),
159+ reasoning = review .get ("reasoning" , "NA" ),
160+ solution = review .get ("solution" , "NA" ),
161+ confidence = review .get ("confidence" , "NA" ),
162+ start_line = review .get ("start_line" , "NA" ),
163+ end_line = review .get ("end_line" , "NA" ),
164+ file_name = review .get ("file_name" , "NA" ),
165+ )
166+ markdown_output += ct + "\n "
167+ if high_ranked_issues > 0 :
168+ markdown_output = (
169+ "❗ This review needs attention. 🚨\n \n Here are some feedback:\n \n "
170+ + markdown_output
171+ )
172+ else :
173+ markdown_output = (
174+ "✅ This is a good review! 👍\n \n Here are some feedback:\n \n "
175+ + markdown_output
176+ )
177+ return markdown_title + markdown_output
0 commit comments