From 3d2a2850912f8dcf43a1b8c345ac92bf93948089 Mon Sep 17 00:00:00 2001 From: mrT23 Date: Tue, 15 Apr 2025 19:28:36 +0300 Subject: [PATCH] Add skip_ci_on_push configuration option for changelog updates --- docs/docs/tools/update_changelog.md | 7 ++++--- pr_agent/settings/configuration.toml | 1 + pr_agent/tools/pr_update_changelog.py | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/docs/tools/update_changelog.md b/docs/docs/tools/update_changelog.md index ff789622..23e620ed 100644 --- a/docs/docs/tools/update_changelog.md +++ b/docs/docs/tools/update_changelog.md @@ -15,6 +15,7 @@ It can be invoked manually by commenting on any PR: Under the section `pr_update_changelog`, the [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L50) contains options to customize the 'update changelog' tool: -- `push_changelog_changes`: whether to push the changes to CHANGELOG.md, or just print them. Default is false (print only). -- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ... -- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true. \ No newline at end of file +- `push_changelog_changes`: whether to push the changes to CHANGELOG.md, or just publish them as a comment. Default is false (publish as comment). +- `extra_instructions`: Optional extra instructions to the tool. For example: "Use the following structure: ..." +- `add_pr_link`: whether the model should try to add a link to the PR in the changelog. Default is true. +- `skip_ci_on_push`: whether the commit message (when `push_changelog_changes` is true) will include the term "[skip ci]", preventing CI tests to be triggered on the changelog commit. Default is true. \ No newline at end of file diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 1a58cc0b..cd3e4aed 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -182,6 +182,7 @@ class_name = "" # in case there are several methods with the same name in push_changelog_changes=false extra_instructions = "" add_pr_link=true +skip_ci_on_push=true [pr_analyze] # /analyze # enable_help_text=true diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index fadf28f1..5b21785b 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -140,11 +140,15 @@ class PRUpdateChangelog: return new_file_content, answer def _push_changelog_update(self, new_file_content, answer): + if get_settings().pr_update_changelog.get("skip_ci_on_push", True): + commit_message = "[skip ci] Update CHANGELOG.md" + else: + commit_message = "Update CHANGELOG.md" self.git_provider.create_or_update_pr_file( file_path="CHANGELOG.md", branch=self.git_provider.get_pr_branch(), contents=new_file_content, - message="[skip ci] Update CHANGELOG.md", + message=commit_message, ) sleep(5) # wait for the file to be updated