Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dynamic labels based on branches #8

Open
TheCleric opened this issue Aug 25, 2020 · 0 comments
Open

Support for dynamic labels based on branches #8

TheCleric opened this issue Aug 25, 2020 · 0 comments

Comments

@TheCleric
Copy link
Contributor

TheCleric commented Aug 25, 2020

My team has a need for dynamic labels based on the branch names in the PR.

Specifically, if we are merging into a branch marked release/XXX (such as release/1.0) then we apply the tag XXX (so release/1.0 would get the tag 1.0).

To facilitate this I have added a feature to my fork of this library that is completely backwards compatible, but allows specifying regular expressions with groups, and labels based off those groups.

For example in my use case above, you could create a config like so:

$1:
  baseRegExp: 'release[/](.*)'

This would then attempt to match the base branch of a PR with the above regular expression. If it matches it would apply the first matched group ($1) as the label. So release/1.0 would return 1.0 as the label as needed above.

Here's the release version with the change in it (including unit tests).

https://github.com/TheCleric/pr-branch-labeler/tree/v3.1

If you feel like this would be of benefit to merge into your library, please let me know and I'll create a PR. I also recognize that this may be a little too specific or complex for the goal of this library. Either way is fine with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant