knope icon indicating copy to clipboard operation
knope copied to clipboard

Question: Can Knope Bot's commit message and/or PR title be customized?

Open alan910127 opened this issue 8 months ago • 5 comments

When using knope release, the configuration option title.template allows customization of the pr title for the release step. However, I couldn’t find any settings related to customizing the commit message or pr title created by the gh bot. Are these currently configurable? If not, would you consider supporting this as a feature request?

alan910127 avatar Apr 29 '25 15:04 alan910127

They aren't configurable yet, but they absolutely should be. I'm also trying to figure out how to make release notes more customizable, since folks have asked to be able to add commit hashes.

Ideas welcome!

Are you just looking for a different static message, or would you want some dynamic info included?

dbanty avatar Apr 29 '25 15:04 dbanty

Sorry for the late response. I'm just looking for a different static message currently, but dynamic ones would be cool!

alan910127 avatar May 03 '25 09:05 alan910127

Well static is super easy to start with! I just deployed a change that lets you do this in your knope.toml:

[bot.releases]
enabled = true
pull_request.title = "Whatever you want here"

That will set both the title of the pull request and the commit message that Knope uses on its knope/release branch. Give it a try and let me know how that works for you before I document it 😁.

I think we can also add the dynamic $version without too much trouble, just need to figure out what happens if you use that but there are multiple package versions (for monorepos). Can't exactly just error in the bot like we do in the CLI 🤔.

dbanty avatar May 03 '25 17:05 dbanty

Thank you for your great work! I think the addition of $version would be great for my use case (only one package) if possible.

alan910127 avatar May 04 '25 13:05 alan910127

Alright, version should now be enabled in two flavors:

  1. You can still just set a string and now include the default $version variable where you'd like: pull_request.title = "Time to release $version!"
  2. You can use the same template syntax as CreatePullRequest:
[bot.releases]
enabled = true

[bot.releases.pull_request.title]
template = "I need to preserve $version and instead replace {version}"
variables = {"{version}" = "Version"}

I kinda doubt the latter is really needed right now, but I figure I should keep it around for consistency 😁

dbanty avatar May 04 '25 17:05 dbanty

Thank you again for the amazing support, just updated my config to use the new option!

alan910127 avatar May 05 '25 05:05 alan910127