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
641 stars 201 forks source link

[Bug] new_version/new_tag is never undefined #149

Closed mibollma closed 1 year ago

mibollma commented 2 years ago

The documentation states

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.

However, to me it seems that a new version is always calculated even if there is no new commit and already a version on the current commit. This is especially a problem when re-executing jobs that failed in a later stage.

The output looks like this:

Previous tag was v0.105.0, previous version was 0.105.0.
::set-output name=previous_version::0.105.0
::set-output name=previous_tag::v0.105.0
(fd19ad2***...fd19ad2a***)
Analysis of 0 commits complete: no release
::set-output name=release_type::minor
New version is 0.106.0.
::set-output name=new_version::0.106.0
New tag after applying prefix is v0.106.0.
::set-output name=new_tag::v0.106.0
[0.106.0](***/compare/v0.105.0...v0.106.0) (2022-10-19)
.
::set-output name=changelog::## [0.106.0](***/compare/v0.105.0...v0.106.0) (2022-10-19)
[0.106.0](***/compare/v0.105.0...v0.106.0) (2022-10-19)
Dry run: not performing tag action.
jimsihk commented 1 year ago

I have the same problem actually. However, if following the suggestions (https://github.com/mathieudutour/github-tag-action/issues/141, https://github.com/mathieudutour/github-tag-action/issues/85, https://github.com/mathieudutour/github-tag-action/issues/26) to set default_bump to false, the values new_version and new_tag will always be undefined even if there is commit (is that because the commit messages are not in semantic format?):

> Run mathieudutour/github-tag-action@v6.1
  with:
    github_token: ***
    default_bump: false
    release_branches: .*
    dry_run: true
    default_prerelease_bump: prerelease
    tag_prefix: v
    create_annotated_tag: false
    fetch_all_tags: false
Previous tag was 401.104.5, previous version was 401.104.5.
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analyzing commit: Test nightly build and release
The commit should not trigger a release
Analysis of 7 commits complete: no release

This is what I used in the yaml:

      - name: Get next version
        id: next_tag_version
        uses: mathieudutour/github-tag-action@v6.1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          default_bump: false
          release_branches: .*
          dry_run: true

At last, I switched to https://github.com/anothrNick/github-tag-action as alternative solution...

mibollma commented 1 year ago

We wrote our own action to bump the version, which for our use-case was quite simple with a bit of git and regex.