Add configuration option to control publish of no code suggestions message

This commit is contained in:
Pratul Sanwal
2024-11-01 14:47:47 -04:00
parent 15e8c988a4
commit 443d06df06
2 changed files with 10 additions and 6 deletions

View File

@ -7,6 +7,7 @@ fallback_models=["gpt-4o-2024-05-13"]
git_provider="github" git_provider="github"
publish_output=true publish_output=true
publish_output_progress=true publish_output_progress=true
publish_output_no_suggestions=true
verbosity_level=0 # 0,1,2 verbosity_level=0 # 0,1,2
use_extra_bad_extensions=false use_extra_bad_extensions=false
# Configurations # Configurations

View File

@ -113,12 +113,15 @@ class PRCodeSuggestions:
if (data is None or 'code_suggestions' not in data or not data['code_suggestions'] if (data is None or 'code_suggestions' not in data or not data['code_suggestions']
and get_settings().config.publish_output): and get_settings().config.publish_output):
get_logger().warning('No code suggestions found for the PR.') get_logger().warning('No code suggestions found for the PR.')
pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
get_logger().debug(f"PR output", artifact=pr_body) if (get_settings().config.publish_output_no_suggestions):
if self.progress_response: pr_body = "## PR Code Suggestions ✨\n\nNo code suggestions found for the PR."
self.git_provider.edit_comment(self.progress_response, body=pr_body) get_logger().debug(f"PR output", artifact=pr_body)
else: if self.progress_response:
self.git_provider.publish_comment(pr_body) self.git_provider.edit_comment(self.progress_response, body=pr_body)
else:
self.git_provider.publish_comment(pr_body)
return return
if (not self.is_extended and get_settings().pr_code_suggestions.rank_suggestions) or \ if (not self.is_extended and get_settings().pr_code_suggestions.rank_suggestions) or \