Skip to content
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

{{version}} in commitMessageExtra contains "v" #13299

Closed
jbergstroem opened this issue Dec 28, 2021 · 20 comments · Fixed by #16831
Closed

{{version}} in commitMessageExtra contains "v" #13299

jbergstroem opened this issue Dec 28, 2021 · 20 comments · Fixed by #16831
Assignees
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@jbergstroem
Copy link
Contributor

How are you running Renovate?

WhiteSource Renovate hosted app on github.com

If you're self-hosting Renovate, tell us what version of Renovate you run.

No response

Please select which platform you are using if self-hosting.

No response

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Describe the bug

When using {{version}} in commitMessageExtra it contains a "v" as part of the version string when bumping a github action. It is my understanding that renovateBot would only output the version number, not the string (from the documentation: "version: The version number of the changelog").

Using the following configuration (via package.json):

{
    "semanticCommits": "enabled",
    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "v{{newVersion}}"
}

..I get:
Screen Shot 2021-12-28 at 8 11 27 AM

..and in 90% of the PRs created I only see strings like:

  • chore(deps): vitest v0.0.117
  • chore(deps): @commitlint/cli v16.

Perhaps it is intentional? If so;

  1. Should I create a PR to clarify this in the documentation, and
  2. Any ideas on how to handle this from a formatting point of view? 😄

Relevant debug logs

Logs
Copy/paste any log here, between the starting and ending backticks

Have you created a minimal reproduction repository?

No reproduction repository

@jbergstroem jbergstroem added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Dec 28, 2021
@HonkingGoose
Copy link
Collaborator

    "commitMessageExtra": "v{{newVersion}}"

Have you tried using removing the v character from the "commitMessageExtra": "{{newVersion}}" configuration option and seeing what that gives you?

@jbergstroem
Copy link
Contributor Author

jbergstroem commented Dec 29, 2021

    "commitMessageExtra": "v{{newVersion}}"

Have you tried using removing the v character from the "commitMessageExtra": "{{newVersion}}" configuration option and seeing what that gives you?

Thanks for the suggestion. Unfortunately that would lead to the default case of not having v before the version number (except in this case just reported)

@HonkingGoose
Copy link
Collaborator

Oh okay, it was worth a try maybe... 😄

@rarkins
Copy link
Collaborator

rarkins commented Dec 30, 2021

I think what we should do is add two new derived values prettyNewVersion and prettyNewMajor which are exposed to templating. These should prepend v to the newVersion and newMajor if it doesn't already exist. Then we can update our default templates to use it instead of e.g. v{{newVersion}}.

@rarkins rarkins added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Dec 30, 2021
@jbergstroem
Copy link
Contributor Author

I think what we should do is add two new derived values prettyNewVersion and prettyNewMajor which are exposed to templating. These should prepend v to the newVersion and newMajor if it doesn't already exist. Then we can update our default templates to use it instead of e.g. v{{newVersion}}.

Would that not also not imply that newVersion or newMajor would lack v in the case of said package? Im thinking that's my problem at the moment, no? Perhaps logic surrounding version, newVersion and newMajor is different - but yeah, having specific logic to deal with a prepended v seems to be the way to go.

@rarkins
Copy link
Collaborator

rarkins commented Dec 30, 2021

What I propose has no effect on newVersion or newMajor

@jbergstroem
Copy link
Contributor Author

What I propose has no effect on newVersion or newMajor

Gotcha.

@hasanwhitesource hasanwhitesource self-assigned this Jul 18, 2022
@hasanwhitesource
Copy link
Contributor

hasanwhitesource commented Jul 25, 2022

@rarkins newMajor is a number so it can't have a v in its value. Or should we always append v to it through a new option prettyNewMajor ?
Regarding the solution I will expose a new config option called prettyNewVersion for the purpose of to append or not to append v to the newVersion.
Relevant example (renovate.json):

    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "{{prettyNewVersion}}"

Is this what you meant in your approach ?

@hasanwhitesource
Copy link
Contributor

I plan to expose two fields prettyNewMajor and prettyNewVersion to be used.
@HonkingGoose can you please confirm if these should be documented in docs/usage/configuration-templates.md?

@HonkingGoose
Copy link
Collaborator

Can people use prettyNewMajor and prettyNewVersion as "template fields"? If yes, we can probably add these new fields to these docs:

https://docs.renovatebot.com/templates/

@hasanwhitesource
Copy link
Contributor

Can people use prettyNewMajor and prettyNewVersion as "template fields"? If yes, we can probably add these new fields to these docs:

https://docs.renovatebot.com/templates/

Yes for example in this case users would use this way :

    "commitMessageExtra": "{{prettyNewVersion}}"

@hasanwhitesource
Copy link
Contributor

@HonkingGoose what do you think of this description :

prettyNewVersion

returns the newVersion value with v appended to start.

If you want for example to create a pr title having the changed version:

{ "commitMessageExtra": "{{prettyNewVersion}}" }

prettyNewMajor

returns the newMajor value with v appended to start.

@HonkingGoose
Copy link
Collaborator

The basic idea for that text is okay, needs some grammar changes though. 😉

@hasanwhitesource
Copy link
Contributor

@HonkingGoose haven't made a pr yet but do you think it is better to just add this as a templating functionality?
and not as a new field cause we don't want to set prettyNewVersion to a value in the config we just want to prettify newVersion and newMajor.
Example usage :

{
    "semanticCommits": "enabled",
    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "{{prettyNewVersion newVersion}}"
}

@hasanwhitesource
Copy link
Contributor

In this case one can use the replace helper this way to make this work:

"commitMessageExtra":"{{replace '^v*' 'v' newVersion}}"

Examples input and outputs of this:
'v5.1.2' => 'v5.1.2'
'5.1.2' => 'v5.1.2'

@rarkins should we use this or expose the append function in the pr ?

@HonkingGoose
Copy link
Collaborator

@HonkingGoose haven't made a pr yet but do you think it is better to just add this as a templating functionality?

I don't know about this. 😄 I'll let the maintainers decide. 😉

@rarkins
Copy link
Collaborator

rarkins commented Aug 1, 2022

I prefer to popular prettyVersion and prettyNewMajor

@hasanwhitesource
Copy link
Contributor

@rarkins which of these is best for usage:
Option1 (currently open pr) :
We expose a function prettyNewVersion that will prepend v to newVersion or newMajor.

{
    "semanticCommits": "enabled",
    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "{{prettyNewVersion newVersion}}"
}

Option 2 :
Adding prettyVersion ,prettyNewMajor fields in options where both will default to a template that will prepend v if it is missing.

{
    "semanticCommits": "enabled",
    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "{{prettyVersion}}"
}
{
    "semanticCommits": "enabled",
    "commitMessageAction": "",
    "commitMessageTopic": "{{depName}}",
    "commitMessageExtra": "{{prettyNewMajor}}"
}

@rarkins
Copy link
Collaborator

rarkins commented Aug 1, 2022

I think let's go with the second approach

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 32.152.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants