tomasbjerre / git-changelog-maven-plugin

Maven plugin that can generate a changelog, or releasenotes, from git repository
Other
78 stars 35 forks source link

Question: avoiding redundant generation/updating of the changelog #56

Closed arkadioz closed 9 months ago

arkadioz commented 9 months ago

Sorry this might be a obvious/silly question, but im having trouble figuring out how to avoid regenerating the changelog in this following situation were I would run in an infinite updating:

1) finish development of new feature so make the commit. 2) run mvn generate-resources locally so that it generates/updates the changelog and also the new semantic-version. 3) commit "updating changelog and version".

now after that is were I am having this little doubt because I would like the "changelog and version update commit" to be reflected in the changelog, but if I run again mvn generate-resources then I will have to commit again this change, havent been able to see how you avoid this?

How yourself @tomasbjerre deal with this situation? I see you mention in the documentation "You can combine it with maven release plugin", im not sure if this is how you deal with this scenario, but I will check it out, meanwhile I appreciate your responses thank you

tomasbjerre commented 9 months ago

I update the changelog with git commit -a -m "chore: updating changelog" and I don't include chore in my changelogs.

arkadioz commented 9 months ago

I update the changelog with git commit -a -m "chore: updating changelog" and I don't include chore in my changelogs.

Please share the file where you have this config to ignore / not include chore so I can use as example

tomasbjerre commented 9 months ago

I use this template: https://github.com/tomasbjerre/git-changelog-lib/blob/master/src/main/resources/changelog.mustache

Another option is to ignore commits by regexp: https://github.com/tomasbjerre/git-changelog-maven-plugin/blob/c23bba833b5f26e5c349e1bc24dc67f3208f236b/git-changelog-maven-plugin-example/pom.xml#L154

arkadioz commented 9 months ago

@tomasbjerre Sorry I could not see in the changelog.mustache you shared were is the condition to not print / ignore chore commits, they should be going to the "Other Changes" section? because here I think you evaluate that anything that is not feat fix or breaking should then go to the other changes section right? And I belive that then this would include chores

{{#ifContainsType commits type='^($|(?!fix|feat|breaking))'}}

Also I though maybe you were using the <ignoreCommitsIfMessageMatches> tag, but in this config I do not see that specific ignoring chores https://github.com/tomasbjerre/git-changelog-lib/blob/master/changelog.json

tomasbjerre commented 9 months ago

That regexp is a bit weird.

It can be changed to: ^($|(?!fix|feat|breaking).*) and it would match chore. Or changed to ^$ which would have the same effect as its current value.

I should probably change it to avoid confusion.

arkadioz commented 9 months ago

But @tomasbjerre, If it matches chore, then it is not ignored in the current changelog.mustache https://github.com/tomasbjerre/git-changelog-lib/blob/master/src/main/resources/changelog.mustache because here https://github.com/tomasbjerre/git-changelog-lib/blob/d851d75c1dc8d797909128c1519ae9ff937e6f69/src/main/resources/changelog.mustache#L39

is where you start getting "Other changes", which would then match the chores, but when I see the CHANGELOG.md https://github.com/tomasbjerre/git-changelog-lib/blob/master/CHANGELOG.md I see no chores in there, how did you actually ignore the chores?

tomasbjerre commented 9 months ago

No that regexp does not match chore.

arkadioz commented 9 months ago

Hmm I though it did, also the bing chat IA says it does match but I guess its wrong, look its answer:

The regular expression ^($|(?!fix|feat|breaking)) matches any string that either starts with an empty string or does not contain the words fix, feat, or breaking.

This regular expression is used to match the syntax of a Conventional Commit, which is a standardized format for commit messages in software development. The format consists of a type, an optional scope, a subject, and an optional body. The ^($|(?!fix|feat|breaking)) regular expression is used to validate the type field of a Conventional Commit message.

For example, the following strings would match the regular expression ^($|(?!fix|feat|breaking)):

However, the following strings would not match the regular expression ^($|(?!fix|feat|breaking)):

That is the end of its answer

What I understand is that it matches Strings that dont contain fix feat or breaking https://github.com/tomasbjerre/git-changelog-lib/blob/d851d75c1dc8d797909128c1519ae9ff937e6f69/src/main/resources/changelog.mustache#L39

so chore is not a fix feat or breaking, so it matches? But I guess im gonna test it meanwhile because probably the IA is wrong and confused me