Skip to content
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

pass previousTag to conventionalChangelog in gitRawCommitsOpts to select commit messages #47

Merged
merged 1 commit into from Apr 15, 2022
Merged

pass previousTag to conventionalChangelog in gitRawCommitsOpts to select commit messages #47

merged 1 commit into from Apr 15, 2022

Conversation

whorka
Copy link
Contributor

@whorka whorka commented Apr 6, 2022

When using the default release-it changelog generator, I can specify a tag using the --git.tagMatch and --github.tagMatch arguments, and the generated changelog then includes commit messages since the specified tag.

However, when using the @release-it/conventional-changelog plugin, these arguments only control which tag is linked in the changelog headers; they do not control which commit messages appear in the changelog. Only the messages from the most recent semver tag to HEAD are included.

This is the expected behavior from conventional-changelog when it is called the way it is from @release-it/conventional-changelog, with previousTag in the context. The conventional-changelog-core documentation links to the conventional-changelog-writer docs, which say that the context parameter contains "Variables that will be interpolated to the template." This means that the context parameter only defines what shows up in the templated lines of the changelog; it does not affect which commit messages are selected for inclusion. The parameter which controls which commit messages are selected is gitRawCommitsOpts.

To make @release-it/conventional-changelog behave the same way as the default release-it changelog generator, it would be necessary to pass from in gitRawCommitsOpts. Here is a patch that does so.

Alternatively, a workaround is to select the previous tag before running release-it, then invoke release-it with the necessary parameters:

release-it \
  --git.tagMatch="${PREVIOUS_TAG}" \
  --github.tagMatch="${PREVIOUS_TAG}" \
  --'plugins.@release-it/conventional-changelog.gitRawCommitsOpts.from'="${PREVIOUS_TAG}"

It seems to me that @release-it/conventional-changelog ought to behave the same way as the default release-it changelog generator, and use previousTag when selecting the commit messages.

If instead it is intentional that it behave like conventional-changelog and only use the previousTag in the changelog headers and not when selecting the commit messages, then I think that this ought to be noted clearly in the documentation (with the above workaround if possible).

@webpro
Copy link
Contributor

webpro commented Apr 15, 2022

I'm already impressed by the CLI argument to include that from prop alone :)

@webpro webpro merged commit f13909e into release-it:master Apr 15, 2022
@webpro
Copy link
Contributor

webpro commented Apr 15, 2022

Thanks, it's released in v4.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants