Skip to content

feat: implement custom automergeMergeCommitMessage #36205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

idlefella
Copy link

@idlefella idlefella commented May 28, 2025

Changes

  • Option to set custom merge commit message when the branch is automerged by renovate bot

Context

Hi, we're encountering an issue in our build pipelines where distinguishing between automatically merged pull requests and those merged manually is challenging, as this information is only present in the pull request description, not in the git repository or commits themselves. To address this, I added an option automergeMergeCommitMessage which can be used to overwrite the default merge commit message generated by git, but only if automergeType=branch.

NOTE: This PR contains all the commits from my previous PR which it depends on!
See: #35884

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@idlefella idlefella changed the title Feature/implement custom merge message feat: implement custom automergeMergeCommitMessage May 28, 2025
@@ -284,6 +284,25 @@ Example use:
}
```

## automergeMergeCommitMessage

Use this only if you configure `automergeType="branch"` and `automergeStrategy` is `merge-commit` or `squash`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't we just use the PR title for the message for squash?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this applies to squash too then we need to rethink the config option name above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't we just use the PR title for the message for squash?

Does the PR title indicate if the pull request was automerged or not? If so, we could reuse it.

If this applies to squash too then we need to rethink the config option name above

Yes, it will be used for squash commits in the current setup. I don't have a strong opinion on this, but do you think changing the option name would be a good idea? My first suggestion was automergeCommitMessage.

Comment on lines +1015 to +1020
if (commitMessage) {
await gitRetry(() => git.commit(commitMessage));
} else {
// Use the default commit message for the squash commit from git
await gitRetry(() => git.raw(['commit', '--no-edit']));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use the PR title for this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rarkins
I just digged through the code and also tested in on a real world example, but the PR title doesn't contain the information if the pull request was automerged or not. In our setup, I looks like this: Update dependency my-dependency-name to v4.24.1-1. The goal of my PR is to add an option to define a custom commit message if the PR was automerged.

Co-authored-by: Rhys Arkins <rhys@arkins.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants