diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 38a19412..16461b7e 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -162,6 +162,7 @@ class_name = "" # in case there are several methods with the same name in [pr_update_changelog] # /update_changelog # push_changelog_changes=false extra_instructions = "" +add_pr_link=true [pr_analyze] # /analyze # enable_help_text=true diff --git a/pr_agent/settings/pr_update_changelog_prompts.toml b/pr_agent/settings/pr_update_changelog_prompts.toml index a5769355..6825da66 100644 --- a/pr_agent/settings/pr_update_changelog_prompts.toml +++ b/pr_agent/settings/pr_update_changelog_prompts.toml @@ -5,6 +5,9 @@ Your task is to add a brief summary of this PR's changes to CHANGELOG.md file of - Only add new changes (don't repeat existing entries) - Be general, and avoid specific details, files, etc. The output should be minimal, no more than 3-4 short lines. - Write only the new content to be added to CHANGELOG.md, without any introduction or summary. The content should appear as if it's a natural part of the existing file. +{%- if pr_link %} +- If relevant, convert the changelog main header into a clickable link using the PR URL '{{ pr_link }}'. Format: header [*][pr_link] +{%- endif %} {%- if extra_instructions %} diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index 79acf4f5..10547534 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -41,6 +41,7 @@ class PRUpdateChangelog: "description": self.git_provider.get_pr_description(), "language": self.main_language, "diff": "", # empty diff for initial calculation + "pr_link": "", "changelog_file_str": self.changelog_file_str, "today": date.today(), "extra_instructions": get_settings().pr_update_changelog.extra_instructions, @@ -102,6 +103,8 @@ class PRUpdateChangelog: async def _get_prediction(self, model: str): variables = copy.deepcopy(self.vars) variables["diff"] = self.patches_diff # update diff + if get_settings().pr_update_changelog.add_pr_link: + variables["pr_link"] = self.git_provider.get_pr_url() environment = Environment(undefined=StrictUndefined) system_prompt = environment.from_string(get_settings().pr_update_changelog_prompt.system).render(variables) user_prompt = environment.from_string(get_settings().pr_update_changelog_prompt.user).render(variables)