gembaadvantage / uplift

Semantic versioning the easy way. Powered by Conventional Commits. Built for use with CI.
https://upliftci.dev
MIT License
57 stars 7 forks source link

[Feature]: Support trimming any text lines preceding the line containing the conventional commit type #415

Closed albertocsm closed 4 months ago

albertocsm commented 4 months ago

Describe your feature

There are situations where the commit message doesn't start with the conventional commit <type>:. As an example, when using Bitbucket, if the a Squash merge strategy is preferred, when a feature branch is merged into the main branch the commit message will look something similar to:

Merged in add_new_great_feature_branch_name (pull request #999)

feat: added a new great feature

  • chore: fixed issues with my great new feature // original commit messages on the feature branch
  • test: added tests for this great new feature
  • feat: drafted initial impl for my great new feature

Unfortunately, even thought there's a valid conventional commit type in the commit message, it wont be picked up because it just isn't the very first line in message.

Changing this template to something more practical, where the header that precedes the important line is omitted, may be out of of reach for the user for a multitude of reasons. In this scenario the commit log is rendered unusable as far as Uplift goes.

Your potential solution

Introduce a new flag for both release and changelog commands:

uplift release --trim-header
uplift changelog --trim-header

This flag instructs Uplift to disregard any lines before the conventional commit type. Instead of using the entire original commit message, it only considers the trimmed version of the message. The trimmed commit message will start with the line containing the first occurrence of the <type>: token.

Any additional information?

none

Code of Conduct

ga-paul-t commented 4 months ago

@albertocsm, thanks for the contribution.