renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.14k stars 2.23k forks source link

Onboarding commit message ignores lowercase char #22346

Open rarkins opened 1 year ago

rarkins commented 1 year ago

Discussed in https://github.com/renovatebot/renovate/discussions/22342

Originally posted by **simone-dandreta** May 22, 2023 ### How are you running Renovate? Self-hosted ### If you're self-hosting Renovate, tell us what version of Renovate you run. 37.0.0 ### If you're self-hosting Renovate, select which platform you are using. github.com ### If you're self-hosting Renovate, tell us what version of the platform you run. _No response_ ### Was this something which used to work for you, and then stopped? I never saw this working ### Wanted end result. My default.json file is: `{ "extends": ["config:base", ":dependencyDashboard"], "enabledManagers": ["dockerfile"], "commitMessageAction": "bump", "onboardingCommitMessage": "trivial: Configure Renovate" }` but when I look at the onboarding commit message I see: `Trivial: Configure Renovate` with capital 'T' and this breaks our CI checks on semantic commit messages. Am I missing something? ### What you tried so far. You can look at the default.json file posted above. ### Relevant debug logs
Logs ``` Copy/paste the relevant log(s) here, between the starting and ending backticks ```
simone-dandreta commented 1 year ago

I guess the problem might be here?

simone-dandreta commented 1 year ago

@rarkins is there any update about this? Thank you.

rarkins commented 1 year ago

No. PRs welcome

simone-dandreta commented 1 year ago

@rarkins I ran a test and it looks like the issue is that the logic when the prefix is empty:

Normalized Subject: trivial: Configure Renovate
Prefix: 
Title: Trivial: Configure Renovate

so the FormatSubject() func https://github.com/renovatebot/renovate/blob/947babe092ddf8b70357791059296eb876ed4623/lib/workers/repository/model/commit-message.ts#L71

will always uppercase the first letter. Can I just change the logic so it will always be lowercase?

simone-dandreta commented 1 year ago

I need to ask a question about the tests. Why we always uppercase the message first char? Examples:

describe('CustomCommitMessage', () => {
    it.each`
      subject                                      | prefix             | result
      ${'test'}                                    | ${''}              | ${'Test'}
      ${'  test  '}                                | ${'  '}            | ${'Test'}

Also the semantic commit message:

describe('workers/repository/model/semantic-commit-message', () => {
  it('should format message without prefix', () => {
    const message = new SemanticCommitMessage();
    message.subject = 'test';

    expect(message.toString()).toBe('Test');
  });

why can't we just keep the first letter as it is?

zharinov commented 10 months ago
gjrtimmer commented 9 months ago

@zharinov Yes, still needed; currently implementing Renovate Bot on GitLab (Private) Renovate:37.74. The first letter of Onboarding PR is still a Capital case which breaks semantic commit messages and also breaks our tooling and scripting which generates CHANGELOG etc.

I finally have been able to fix this with the following config:

{
  commitMessageLowerCase: "auto",
  commitMessagePrefix: "chore",
  semanticCommits: "enabled",
  semanticCommitType: "chore",
  semanticCommitScope: "deps",
  onboarding: true,
  onboardingCommitMessage: "add renovate configuration",
  onboardingPrTitle: "configure renovate"
}