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

fix: enable creation of versions with commit sha postfix #156

Open mikael-andersson91 opened 1 year ago

mikael-andersson91 commented 1 year ago

What These changes are intended to enable creation of new versions with commit hash as a postfix, without generating an associated tag.

How Identifying pull requests is done by using the GitHub Environment variable GITHUB_EVENT_NAME to identify when the action is triggered by a pull request, read more here. This event is used in the isPr function to identify pull requests. The following functionalities has also been refactored to functions in the utils.ts file:

Why I started experimenting with these changes after creating issue #150 where I noted that the current version of this action does not generate new versions with the commit hash suffix on pull requests targeted at main branch, as described in the Filter branches section of the documentation. During this work I also noticed that some functionality could be refactored into functions for improved readability of the code. Using the environment variable for event name also seemed like a more stable way of identifying pull requests than what was previously in place.

NOTE: This is pretty much a duplicate of pull request 151 which I will be closing. Going to take the master branch of my fork in a different direction but still wanted to keep these changes as an option for this repository.