Merge branch 'main' into tr/user_description

This commit is contained in:
Tal
2024-01-07 22:55:18 -08:00
committed by GitHub
4 changed files with 7 additions and 2 deletions

View File

@ -138,4 +138,4 @@ Examples for custom labels:
The list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
<br>Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.
<br>Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.

View File

@ -75,15 +75,18 @@ class GitProvider(ABC):
def get_user_description(self) -> str:
description = (self.get_pr_description_full() or "").strip()
description_lowercase = description.lower()
get_logger().debug(f"Existing description\n{description_lowercase}")
# if the existing description wasn't generated by the pr-agent, just return it as-is
if not self._is_generated_by_pr_agent(description_lowercase):
get_logger().debug(f"Existing description was not generated by the pr-agent")
return description
# if the existing description was generated by the pr-agent, but it doesn't contain a user description,
# return nothing (empty string) because it means there is no user description
user_description_header = "## user description"
if user_description_header not in description_lowercase:
get_logger().debug(f"Existing description was generated by the pr-agent, but it doesn't contain a user description")
return ""
# otherwise, extract the original user description from the existing pr-agent description and return it
@ -106,6 +109,7 @@ class GitProvider(ABC):
if original_user_description.lower().startswith(user_description_header):
original_user_description = original_user_description[len(user_description_header):].strip()
get_logger().debug(f"Extracted user description from existing description\n{original_user_description}")
return original_user_description
def _possible_headers(self):

View File

@ -108,6 +108,7 @@ class PRDescription:
# final markdown description
full_markdown_description = f"## Title\n\n{pr_title}\n\n___\n{pr_body}"
get_logger().debug(f"full_markdown_description:\n{full_markdown_description}")
if get_settings().config.publish_output:
get_logger().info(f"Pushing answer {self.pr_id}")

View File

@ -1,5 +1,5 @@
aiohttp==3.9.1
atlassian-python-api==3.39.0
atlassian-python-api==3.41.4
azure-devops==7.1.0b3
boto3==1.33.6
dynaconf==3.2.4