mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
support git providers with no label support
This commit is contained in:
@ -228,7 +228,7 @@ class PRDescription:
|
||||
# Iterate over the dictionary items and append the key and value to 'markdown_text' in a markdown format
|
||||
markdown_text = ""
|
||||
# Don't display 'PR Labels'
|
||||
if 'PR Labels' in self.data:
|
||||
if 'PR Labels' in self.data and self.git_provider.is_supported("get_labels"):
|
||||
self.data.pop('PR Labels')
|
||||
if not get_settings().pr_description.enable_pr_type:
|
||||
self.data.pop('PR Type')
|
||||
|
@ -82,11 +82,18 @@ class PRGenerateLabels:
|
||||
|
||||
if get_settings().config.publish_output:
|
||||
get_logger().info(f"Pushing labels {self.pr_id}")
|
||||
|
||||
current_labels = self.git_provider.get_labels()
|
||||
if current_labels is None:
|
||||
current_labels = []
|
||||
pr_labels = pr_labels + current_labels
|
||||
|
||||
if self.git_provider.is_supported("get_labels"):
|
||||
current_labels = self.git_provider.get_labels()
|
||||
if current_labels is None:
|
||||
current_labels = []
|
||||
self.git_provider.publish_labels(pr_labels + current_labels)
|
||||
self.git_provider.publish_labels(pr_labels)
|
||||
elif pr_labels:
|
||||
value = ', '.join(v for v in pr_labels)
|
||||
pr_labels_text = f"## PR Labels:\n{value}\n"
|
||||
self.git_provider.publish_comment(pr_labels_text, is_temporary=False)
|
||||
self.git_provider.remove_initial_comment()
|
||||
except Exception as e:
|
||||
get_logger().error(f"Error generating PR labels {self.pr_id}: {e}")
|
||||
|
Reference in New Issue
Block a user