I have a case where I need to include the commit in the semantic-release/commit-analyzer
but not in semantic-release/release-notes-generator
. Is it possible to do this in Github actions semantic release?

- 355
- 6
- 19
-
What is the commit? Is this a once off, or will it keep recurring? – 2e0byo Sep 27 '21 at 08:13
-
It will come every 2weeks with an automated commit but need in commit analysis. – lakshmiravali rimmalapudi Sep 27 '21 at 10:03
1 Answers
Semantic-release will only (by default) include commits which trigger a release in the release notes. So commits which e.g. begin with ci:
or refactor:
don't make it through.* I think this is your usecase here---an automated commit which triggers some action but does not in itself constitute a release.
Update it seems you really do want to trigger a version bump without documenting what you did. I think that's a bad idea (expanded below), but it is possible with a hack like this:
Silent Commits
The whole point of semantic-release is that every version-bump-worthy change is documented. However if you really want to produce a hidden bump, you can use a hack along the lines of:
- save latest tag to a var or file
- run semantic release without the
@semantic-release/github
action, but with the@semantic-release/changelog
action, writing the changelog somewhere that the git release will not pick it up, i.e. outside the cloned dir. - run a custom script which:
- parses your changelog.md
- gets the most recent release notes (easy: parse by headline)
- checks whether you have released, i.e. if the first headline tag is not the tag you got in step 1.
- strips out the 'bad' line
- outputs to stdout (redirect to a var) or writes somewhere
- iff there is some output, create the github release yourself, using one of the various actions, and set the message to be the output from your script.
Reasons not to do this
I'm just some random guy on the internet, but I don't think this is a good idea. Reasoning:
The whole point about semantic-release is to make releasing 'boring and unromantic': more specifically that every release-worthy commit triggers a documented release. Now either your automated fix: stuff
commit does actually fix stuff (in which case this is noteworthy and should be included), or it doesn't, in which case you have some other problem (maybe you are trying to release for 'romantic and interesting' reasons? Maybe you need a release every n days even if nothing has actually changed?). In either case, hiding a legitimate fix is not the way to go about it.
If your problem is a kind of 'microfix' which should generate a release, but happens so frequently as to clog up the release notes, you might want a prerelease branch (where lots of microfixs get rolled up into one big fix in the merge commit).
*assuming you're using conventional commits

- 5,305
- 1
- 6
- 26
-
Thanks for the response. I have some commit named "fix: Updated some definitions", This commit I want to participate in commit analysis for the version bump, but don't want to include in the release notes. – lakshmiravali rimmalapudi Sep 27 '21 at 10:40
-
I still don't know *why* you want to do this, but I've updated the answer to make it clearer how you can hack this in github actions. But per my comments I think this might be an x/y problem (I could definitely be wrong, though). – 2e0byo Sep 27 '21 at 11:17
-
Sometimes there is just a typo in the README.md or similar auxillary files which is not packaged in a release artifact. – aries1980 Apr 26 '23 at 09:52