dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.62k stars 987 forks source link

How to make the commit message as title case #7408

Open yufeiminds opened 1 year ago

yufeiminds commented 1 year ago

Hi, team.

Our repository requires that the PR title adheres to the Conventional Commits specification, which is ensured through amannn/action-semantic-pull-request. We specifically check that the PR title follows the title case, meaning the first character must be uppercase. To meet this requirement, we need to change the auto-bump commit message from "bump xxx" to "Bump xxx". For more clarity, we have provided a detailed example in the form of a Demo Pull Request.

From:

chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4

To:

chore(deps): Bump github.com/stretchr/testify from 1.8.3 to 1.8.4

I have gone through the documentation, but it seems like the commit_message can only modify the prefix. Hence, I am wondering how I can configure the file to modify the message into a title case format. Would appreciate any assistance, thank you very much.

DanyC97 commented 10 months ago

And i'm doing similar thing but i have decide to enforce all my PRs to be lowercase using the action config headerPattern: '^(\w*?)(?:\(([\w$.\-*/ ]*)\))?: (.*)$'

Saying that i do see through the code some lack of consistency because in some PRs

What i can say is that it matters if is a security alert created PR or non-security one

I short i don't see how you can manage this as there are different permutations here. Hopefully the product will add a flag to control it in same way prefix is been added, that will be a nice sweet-spot for everyone imo

steebchen commented 10 months ago

This would be nice to configure. For me, I need it the other way round, somehow it always uses uppercase even though most commits are lowercase, and now there doesn't seem to be a way to make dependabot use lowercase 😢

deivid-rodriguez commented 10 months ago

Hi!

This is currently not configurable but Dependabot should be automatically detect the proper casing using based on its own previous commit.

So if this is not working as expected, you can manually change the commit message to the proper case before merging the Dependabot PR, and further Dependabot PRs should respect that.

steebchen commented 10 months ago

I think the problem is that (recently?) it seems to be not working right. Look at this history for example:

image

Suddenly the commit message uses Bump, even though all the previous commit messages use lower case.

deivid-rodriguez commented 10 months ago

@steebchen Indeed! I discovered a bug here yesterday, and https://github.com/dependabot/dependabot-core/pull/8355 should fix it. Once that's shipped you can amend the message as suggested and then casing from then on should respect your preference.

steebchen commented 10 months ago

Awesome, thanks :D