From 7d89b829670a5667e90b1061bf1925ede2fd6427 Mon Sep 17 00:00:00 2001 From: Zohar Meir <33152084+zmeir@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:41:14 +0200 Subject: [PATCH] Fix `get_user_description` in case `pr_description.enable_pr_type=false` Fixes an issue when getting the user description after a PR-Agent description was already generated, in case the configuration setting `pr_description.enable_pr_type` was `false`. --- pr_agent/git_providers/git_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/git_providers/git_provider.py b/pr_agent/git_providers/git_provider.py index 1e18d86e5..4a41e252c 100644 --- a/pr_agent/git_providers/git_provider.py +++ b/pr_agent/git_providers/git_provider.py @@ -107,7 +107,7 @@ def get_pr_description(self, *, full: bool = True) -> str: def get_user_description(self) -> str: description = (self.get_pr_description_full() or "").strip() # if the existing description wasn't generated by the pr-agent, just return it as-is - if not description.startswith("## PR Type"): + if not any(description.startswith(header) for header in ("## PR Type", "## PR Description")): return description # if the existing description was generated by the pr-agent, but it doesn't contain the user description, # return nothing (empty string) because it means there is no user description