mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-14 09:40:39 +08:00
fix: implement dedicated method for cleaning PR titles
This commit is contained in:
@ -168,7 +168,7 @@ class PRDescription:
|
|||||||
get_logger().debug(f"Labels are the same, not updating")
|
get_logger().debug(f"Labels are the same, not updating")
|
||||||
|
|
||||||
# publish description
|
# publish description
|
||||||
pr_title_clean = pr_title.strip().replace('\n', ' ')
|
pr_title_clean = self.clean_title(pr_title)
|
||||||
if get_settings().pr_description.publish_description_as_comment:
|
if get_settings().pr_description.publish_description_as_comment:
|
||||||
full_markdown_description = f"## Title\n\n{pr_title_clean}\n\n___\n{pr_body}"
|
full_markdown_description = f"## Title\n\n{pr_title_clean}\n\n___\n{pr_body}"
|
||||||
if get_settings().pr_description.publish_description_as_comment_persistent:
|
if get_settings().pr_description.publish_description_as_comment_persistent:
|
||||||
@ -759,6 +759,12 @@ class PRDescription:
|
|||||||
"""
|
"""
|
||||||
return pr_body
|
return pr_body
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clean_title(title: str) -> str:
|
||||||
|
"""Clean the PR title by stripping whitespace and replacing newlines with spaces."""
|
||||||
|
return title.strip().replace('\n', ' ')
|
||||||
|
|
||||||
|
|
||||||
def count_chars_without_html(string):
|
def count_chars_without_html(string):
|
||||||
if '<' not in string:
|
if '<' not in string:
|
||||||
return len(string)
|
return len(string)
|
||||||
|
Reference in New Issue
Block a user