mathieudutour / mathieudutour/github-tag-action
Default value for release_branches unexpectedly matches substring
- Dominant language
- TypeScript
- Stars
- 733
- Forks
- 227
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
Research direction
Start with the default release_branches value in action.yml and then read the branch-matching logic in src/action.ts. Confirm how the current defaults behave for branches containing "main" or "master" as substrings; done means the defaults match only the exact main and master branch names while preserving the documented workaround behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd, release
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100