Logerfo / gitflow-action

Automatically creates and merges pull requests from master to dev and from release to master.
MIT License
23 stars 15 forks source link

Update release and master branch to support regex #54

Closed jasonvooo closed 1 year ago

jasonvooo commented 4 years ago

Update release and master branch attribute to be based on a regex. This is due to my requirement that I wanted this to work for RELEASE/xxx branches. This will still work with default branches if no regex is used since the condition below.

if ("release".match(new RegExp("release"))) return "I WILL BE TRUE"

Thanks for the action it is really awesome


View rendered README.md

Logerfo commented 4 years ago

Hello, @jasonvooo. Thank you for your contribution, I think it's a great improvement for the action. Before merging your pull request, it'd be nice to settle some possible issues: 1) Why does the master branch also support regular expressions? This branch has two purposes: 1) Be the target branch for the "release to master" scenario. In this case, it doesn't seem to make sense to support them, since you cannot have two target branches. 2) Be the head branch for the "master to dev" scenario. In this case, it also doesn't seem to make sense to support them, since there can only be one master branch. 2) It's true that the action will still work for default branches if no regular expression is used, but that is not enough to disregard as a breaking change. The changes you propose will actually make the action start to behave differently after updating, even with the same configuration, since the current default behavior can be expressed in a regular expression as /^release$/, but your code will generate the expression /release/. I thought about automatically converting release to ^release$, but I don't think it's prudent to do so, because that would make it impossible to actually write the regular expression /release/ when needed. Do you have any suggestion on how to make this non-breaking? Maybe create a new configuration parameter, such as release-regex (boolean, defaults to false).