Skip to content

Default value for release_branches unexpectedly matches substring #219

@remy-niles

Description

@remy-niles

I am willing to provide a simple pull request to fix the following issue, and am opening an issue to get some initial feedback.

The default values used for the release_branches parameter are matched as substrings by default instead of an exact string and so in some cases where the letters "main" or "master" appear in a branch name, a release tag will be generated. An example would be the word "maintenance" which contains the word "main".

This is the referenced parameter: https://github.com/mathieudutour/github-tag-action/blob/master/action.yml#L42-L45

The described behaviour is due to the fact that the String.match method used to match branch names matches for a substring by default: https://github.com/mathieudutour/github-tag-action/blob/master/src/action.ts#L55-L57

Although issues have a low chance of occurrence, it has occurred and has lead to wasted time troubleshooting.

Workaround and Solution
A workaround is possible by passing in the argument ^main$,^master$ when invoking the action, but we would prefer keeping as much default behaviour as possible.

The proposed solution is to change the default value of the parameter from "main,master" to "^main$,^master$".

Does this seem acceptable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions