mathieudutour / github-tag-action

A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
https://github.com/marketplace/actions/github-tag
MIT License
624 stars 195 forks source link

Still creating new releases when no commits present #218

Open luketainton opened 1 month ago

luketainton commented 1 month ago

The readme says that if no commits are present, new_tag should be undefined. However it appears that when no commits are present, it is using default_bump instead.

Output from GitHub Actions run:

Screenshot 2024-07-15 at 19 50 27

Specifically these logs:

Previous tag was v0.2.0, previous version was 0.2.0.
Analysis of 0 commits complete: no release
New version is 0.3.0.
chrisleves commented 1 day ago

well the doc is not clear

it says

new_tag - The value of the newly calculated tag. Note that if there hasn't been any new commit, this will be undefined. new_version - The value of the newly created tag without the prefix. Note that if there hasn't been any new commit, this will be undefined.

but also says

default_bump (optional) - Which type of bump to use when none is explicitly provided when commiting to a release branch (default: patch). You can also set false to avoid generating a new tag when none is explicitly provided. Can be patch, minor or major. default_prerelease_bump (optional) - Which type of bump to use when none is explicitly provided when commiting to a prerelease branch (default: prerelease). You can also set false to avoid generating a new tag when none is explicitly provided. Can be prerelease, prepatch, preminor or premajor.

overall the code is doing this

// Determine if we should continue with tag creation based on main vs prerelease branch let shouldContinue = true; if (isPrerelease) { if (!bump && defaultPreReleaseBump === 'false') { shouldContinue = false; } } else { if (!bump && defaultBump === 'false') { shouldContinue = false; } }

since the default value for bump or defaultBump are patch and prerelease, the shouldContinue is always true!!

I still don't fully understand how it should behave !