mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 12:50:38 +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
|
# Iterate over the dictionary items and append the key and value to 'markdown_text' in a markdown format
|
||||||
markdown_text = ""
|
markdown_text = ""
|
||||||
# Don't display 'PR Labels'
|
# 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')
|
self.data.pop('PR Labels')
|
||||||
if not get_settings().pr_description.enable_pr_type:
|
if not get_settings().pr_description.enable_pr_type:
|
||||||
self.data.pop('PR Type')
|
self.data.pop('PR Type')
|
||||||
|
@ -82,11 +82,18 @@ class PRGenerateLabels:
|
|||||||
|
|
||||||
if get_settings().config.publish_output:
|
if get_settings().config.publish_output:
|
||||||
get_logger().info(f"Pushing labels {self.pr_id}")
|
get_logger().info(f"Pushing labels {self.pr_id}")
|
||||||
if self.git_provider.is_supported("get_labels"):
|
|
||||||
current_labels = self.git_provider.get_labels()
|
current_labels = self.git_provider.get_labels()
|
||||||
if current_labels is None:
|
if current_labels is None:
|
||||||
current_labels = []
|
current_labels = []
|
||||||
self.git_provider.publish_labels(pr_labels + current_labels)
|
pr_labels = pr_labels + current_labels
|
||||||
|
|
||||||
|
if self.git_provider.is_supported("get_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()
|
self.git_provider.remove_initial_comment()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
get_logger().error(f"Error generating PR labels {self.pr_id}: {e}")
|
get_logger().error(f"Error generating PR labels {self.pr_id}: {e}")
|
||||||
|
Reference in New Issue
Block a user