Add skip_ci_on_push configuration option for changelog updates

This commit is contained in:
mrT23
2025-04-15 19:28:36 +03:00
parent b1bc77c809
commit 3d2a285091
3 changed files with 10 additions and 4 deletions

View File

@ -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 ...
- `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.

View File

@ -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

View File

@ -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