wakatime / semver-action

Auto-generate the next semantic version.
MIT License
11 stars 0 forks source link

Add ancestor tag #7

Closed gandarez closed 3 years ago

gandarez commented 3 years ago

This PR prints the previous matching tag if found. It's a preparation for changelog action to correcttly print the changelog based on what's already merged to the branch.

Let's think this scenario where tags are:

Before adding this feature we only had previous tag returning v2.0.0-dev.1 for master branch and there wasn't no way to actually return the previous tag for master. In this proposal it will return v1.0.0 which is useful for Changelog to correctly print all commits between v1.0.0 and v2.0.0 instead of only printing the commits between v2.0.0-dev.1 and v2.0.0.

gandarez commented 3 years ago

So the resulting tag is the latest non-prerelease tag, right? Or in other words the latest release tag, correct?

Actually the result depends on which tag you're looking for. For master will always return the following pattern {version_label}[0-9]* and for develop branch will always return {version_label}[0-9]*-{pre_release_id}*.

Using the example I gave. If the calculated semver is v2.0.0 the previous matching tag will be v1.0.0 instead of v2.0.0-dev.1. In the other hands if the calculated semver is v2.0.0-dev.1 the previous matching tag will be v1.0.0-dev.1. Does it make sense?

All in all the name "previous matching tag" confuses me a little bit. It seems to describe what you do on a technical level, rather than describe what it actually is.

Do you have a better and simple description for it? I don't :(

dron22 commented 3 years ago

Do you have a better and simple description for it? I don't :(

Thanks for clarifying :+1: I thought about it and we could use preceding tag. This would express, that we search for the previous tag in a specific line (prerelease tags or release tags).

gandarez commented 3 years ago

Do you have a better and simple description for it? I don't :(

Thanks for clarifying 👍 I thought about it and we could use preceding tag. This would express, that we search for the previous tag in a specific line (prerelease tags or release tags).

What about ancestor tag? The git docs refers to both matching and ancestor.

dron22 commented 3 years ago

What about ancestor tag? The git docs refers to both matching and ancestor.

ancestor tag sounds good to me :+1: