Skip to content

fix(prepare): variable substitution for ${nextRelease.notes}#17

Merged
Jno21 merged 2 commits into
Jno21:betafrom
matherm-aboehm:fix/commit-message-variables-upstream
May 11, 2026
Merged

fix(prepare): variable substitution for ${nextRelease.notes}#17
Jno21 merged 2 commits into
Jno21:betafrom
matherm-aboehm:fix/commit-message-variables-upstream

Conversation

@matherm-aboehm

@matherm-aboehm matherm-aboehm commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Description

This PR resolves a bug in template variable substitution for the commit message created in the prepare step of semantic-release-github-commit. It was missing the substitution for ${nextRelease.notes}.

Code changes

  • src/prepare.ts: Add another call to replace on commitMessage, so that ${nextRelease.notes} is replaced with the actual value of that property from nextRelease context

Ready to merge?

  • Fixed tests to reflect these changes
  • All tests passed

@Jno21

Jno21 commented May 10, 2026

Copy link
Copy Markdown
Owner

Hi @matherm-aboehm,

Thanks for checking out this repository and making a PR. This variable was intentionally omitted — embedding the full release notes in a commit message isn't necessarily the right approach, as they can be arbitrarily large. The release notes will be directly accessible in the GitHub Release.

Is there any specific reason you would want it in the commit message ?

@matherm-aboehm

matherm-aboehm commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Jno21,

First of all I thought this plugin is meant to be an expansion or alternative to the default @semantic-release/git plugin?
This variable is supported there and it was also mentioned in the Readme to be supported here.

Second, I don't think it should be the concern of the plugin, what will be included in the commit message and what not, as there is also the possibility to override the default template by the user of the plugin.
When release notes tend to be to large for commit messages, the user could just use the default template or something different not including this variable.
On the other side, without this fix, the user would be unable to include the release notes if he wants it in the commit message.

To answer your question:
Yes I would want all information that describes the commit in the description section of a commit message. The subject line tends to be to short in most situations, so I often use these extra lines and would not want to have an exception just because the message was created automatically by a bot.
I've seen this practice very often in many other open source repositories.
Also, most of the time the release notes that I have seen so far aren't that big that it would not fit in a normal commit message. Technically there is no limit (besides the hardware/OS you use) for commit messages at all, you could just add 100 MB of text to it if you want. This does not mean that I would recommend that you should add kilobytes of text to each and every commit, I was just pointing to the technical side.

There can also be a benefit to have the release notes in both the GitHub Release and the commit message, as you would be able to always read them, even when GitHub sites are down or you just work offline for some reason (Internet connection can sometimes be unstable here in Germany).

As all of this may be my personal preference and yours may be different, I still think this shouldn't be subject to the feature set of the plugin.

@Jno21

Jno21 commented May 11, 2026

Copy link
Copy Markdown
Owner

Thanks for the clear answer.

It has been a while since I last touched the repo, so your clarification makes perfect sense and helped me understand the use case better.

I will merge it and release a fix today :)

Thanks a lot for the contribution.

Jno21
Jno21 previously approved these changes May 11, 2026
@Jno21
Jno21 dismissed their stale review May 11, 2026 11:27

The merge-base changed after approval.

@Jno21
Jno21 changed the base branch from beta to main May 11, 2026 11:29
@Jno21
Jno21 changed the base branch from main to beta May 11, 2026 11:29
@Jno21
Jno21 force-pushed the fix/commit-message-variables-upstream branch from 676f783 to 141bde0 Compare May 11, 2026 11:37
@Jno21
Jno21 merged commit 30ef50e into Jno21:beta May 11, 2026
5 checks passed
Jno21 added a commit that referenced this pull request May 25, 2026
…18)

* fix(prepare): variable substitution for `${nextRelease.notes}` (#17)

* fix(prepare): variable substitution for `${nextRelease.notes}`
* test(prepare): fix test with template variables in commit message

* chore(release): update package.json version to 1.0.1-beta.1 [skip ci]

---------

Co-authored-by: Andreas Böhm <60391995+matherm-aboehm@users.noreply.github.com>
Co-authored-by: semantic-release-github-commit[bot] <238512118+semantic-release-github-commit[bot]@users.noreply.github.com>
Jno21 added a commit that referenced this pull request May 25, 2026
…18)

---------

Co-authored-by: Andreas Böhm <60391995+matherm-aboehm@users.noreply.github.com>
Co-authored-by: semantic-release-github-commit[bot] <238512118+semantic-release-github-commit[bot]@users.noreply.github.com>
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.

2 participants