-
Notifications
You must be signed in to change notification settings - Fork 653
Add support for indicating change severity in commit messages #489
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
Add support for indicating change severity in commit messages #489
Conversation
Nice, I will hold off on this until 3.0 has been released (which should be soon) |
098af0d
to
765a7b5
Compare
I've rebased onto master after the 3.0.2 release. I would like some feedback on those potential issues before a merge, though. This also still needs some unit test coverage. |
Awesome, will look through it later today. |
Sorry for the delay, just started back at work last week since moving back to Australia. Rather than changing config I think that maybe we change the increment strategy to have something like this (obv this code would not compile/work, but hopefully give you the idea)
This way we don;t have to update any config, it will just light up? |
If we use my approach the commit messages override the increment from the config, solving this issue |
Actually, I think my approach fixes all the issues listed under potential issues? What do you think? |
You are essentially proposing that we always respect commit message severities, rather than have the user specify it via new increment strategies. I have no particular objection to this, but it does not fix all of the problems. This code overrides the normal increment strategy when it finds relevant commit messages. However, the increment strategy is ignored entirely if the version strategy returns a There is also still the issue of alpha (< 1.0.0) versions. There could easily be many commits tagged as breaking changes, but many users would not expect their version to be bumped up to or beyond 1.0.0 automatically. We could maybe do with having an option to treat breaking changes as minor version increments while the base version is < 1.0.0. |
If we made this strategy always run before the normal increment code. If it finds an increment message then it increments the version, even if the branch setting says not to.
Agreed, if the version we are incrementing is < 1.0 we should just bump minor instead. |
What do you think @thogil? |
Sounds reasonable. I'll have a look at updating the PR later today. |
65e9ea5
to
42a2a1e
Compare
The code now looks for major, minor and patch commit messages. If it finds one, it will use that increment, regardless of the base version There are branch configuration values for the three message regexes, which default to:
There is also a If no commit message increments are found, it falls back to the default behaviour. If the version would have been incremented by |
@JakeGinnivan I don't know why the AppVeyor build is failing. The only thing which looks like an error is coming from Fody, but that error also exists in the (passing) master build. The build just appears to halt silently. |
I'll check it out tomorrow Sent from my Windows Phone From: Thomas Gillenmailto:[email protected] @JakeGinnivanhttps://github.com/JakeGinnivan I don't know why the AppVeyor build is failing. The only thing which looks like an error is coming from Fody, but that error also exists in the (passing) master build. The build just appears to halt silently. — |
@@ -9,18 +9,30 @@ branches: | |||
increment: Patch | |||
prevent-increment-of-merged-branch-version: true | |||
track-merge-target: false | |||
major-version-bump-message: '\+semver:\s?(breaking|major)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config shouldn't be per branch I don't think? Can it be pulled up to root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, sure.
try updating to https://www.nuget.org/packages/Visualize.Fody/0.4.4 |
101033e
to
5fbb8ea
Compare
@@ -9,18 +12,21 @@ branches: | |||
increment: Patch | |||
prevent-increment-of-merged-branch-version: true | |||
track-merge-target: false | |||
commit-message-incrementing: Enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to be configurable per branch?
The default should be set at the root level, you can leave it configurable per branch but it should be an override to whatever is specified in the root
Awesome! One more thing, you are going to have to rewrite history to remove So it works :P |
Oh, good point ;) |
While active, the version increment is determined by reading commit/merge commit messages for markers describing the change severity.
b3d54b8
to
f3947a9
Compare
I am heading out now. I have just put up a PR myself. This will be in 3.1 which should be released tomorrow/saturday |
Thanks for this, its an awesome addition! |
Add support for indicating change severity in commit messages
Really should have added docs for this.. didn't think about that at the time, now I am doing the release thinking we should have.. I might put initial docs in then move the tag :P After I have put the initial docs in if you want to review/add anything feel welcome to |
Adds two new increment strategies:
CommitMessage
andMergeMessage
.While active, the version increment is determined by reading commit/merge commit messages for markers describing the change severity. All new commits introduced since the base version are scanned.
For example, "+semver: breaking" will force a major version bump.
New Branch Configuration Options
major-version-bump-message
: a regex used for parsing breaking changes in commit messages. Defaults to\+semver:\s?(breaking|major)
.minor-version-bump-message
: a regex used for parsing minor changes in commit messages. Defaults to\+semver:\s?(feature|minor)
.message-fallback
: the increment strategy to fall back into if no change severity indicators are found in commit messages, while using theCommitMessage
orMergeMessage
strategies. Defaults toPatch
.Potential Issues
master
branch toCommitMessage
. This will behave the same as it did prior to this change if the user does not have markers in this commit messages. However this could certainly be considered a breaking change.FallbackBaseVersionStrategy
, which never increments versions. Certainly, If I am using GitHub Flow, this is not what I would expect. Changing the behaviour ofFallbackBaseVersionStrategy
when using commit message increments would be an option, but I do not know if this would make sense for other work flows.Addresses #137.