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:
Getting identifier (getIdentifier): Uses the pull request event to make an identifier with the first seven characters of the commit hash on pull requests. On all other events it works as it did before
Check if prerelease branch (isPrereleaseBranch): Uses the preReleaseBranches input to identify if the currentBranch is a prerelease branch. If no preReleaseBranch was given, it returns to false.
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.
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.