mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
feat: add PR link support in changelog updates
This commit is contained in:
@ -162,6 +162,7 @@ class_name = "" # in case there are several methods with the same name in
|
|||||||
[pr_update_changelog] # /update_changelog #
|
[pr_update_changelog] # /update_changelog #
|
||||||
push_changelog_changes=false
|
push_changelog_changes=false
|
||||||
extra_instructions = ""
|
extra_instructions = ""
|
||||||
|
add_pr_link=true
|
||||||
|
|
||||||
[pr_analyze] # /analyze #
|
[pr_analyze] # /analyze #
|
||||||
enable_help_text=true
|
enable_help_text=true
|
||||||
|
@ -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)
|
- 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.
|
- 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.
|
- 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 %}
|
{%- if extra_instructions %}
|
||||||
|
@ -41,6 +41,7 @@ class PRUpdateChangelog:
|
|||||||
"description": self.git_provider.get_pr_description(),
|
"description": self.git_provider.get_pr_description(),
|
||||||
"language": self.main_language,
|
"language": self.main_language,
|
||||||
"diff": "", # empty diff for initial calculation
|
"diff": "", # empty diff for initial calculation
|
||||||
|
"pr_link": "",
|
||||||
"changelog_file_str": self.changelog_file_str,
|
"changelog_file_str": self.changelog_file_str,
|
||||||
"today": date.today(),
|
"today": date.today(),
|
||||||
"extra_instructions": get_settings().pr_update_changelog.extra_instructions,
|
"extra_instructions": get_settings().pr_update_changelog.extra_instructions,
|
||||||
@ -102,6 +103,8 @@ class PRUpdateChangelog:
|
|||||||
async def _get_prediction(self, model: str):
|
async def _get_prediction(self, model: str):
|
||||||
variables = copy.deepcopy(self.vars)
|
variables = copy.deepcopy(self.vars)
|
||||||
variables["diff"] = self.patches_diff # update diff
|
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)
|
environment = Environment(undefined=StrictUndefined)
|
||||||
system_prompt = environment.from_string(get_settings().pr_update_changelog_prompt.system).render(variables)
|
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)
|
user_prompt = environment.from_string(get_settings().pr_update_changelog_prompt.user).render(variables)
|
||||||
|
Reference in New Issue
Block a user