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

Label filters based on Head & Base branch names #27

Open
deepakputhraya opened this issue Nov 6, 2019 · 11 comments
Open

Label filters based on Head & Base branch names #27

deepakputhraya opened this issue Nov 6, 2019 · 11 comments

Comments

@deepakputhraya
Copy link

Are there any plans to add labels based on regex matching head/base branch?

Current config -

feature: ['feature/*', 'feat/*']
fix: fix/*
chore: chore/*
fixed-branch: fixed-branch-name

Suggested config

feature:
  head: ["feature/*", "feat/*"]
hotfix:
  base: master
  ignore: ["develop"]
release:
  head: develop
  base: master

This could give more control over labelling.

@deepakputhraya deepakputhraya changed the title Label filters based on Head & Base Label filters based on Head & Base branch names Nov 6, 2019
@amacado
Copy link
Contributor

amacado commented Nov 6, 2019

Hello @deepakputhraya, I appreciate your idea. Could you be so kind and specify what you mean with the ignore: ["develop"] configuration? We should also discuss if the specified conditions would be combined in an "AND" or "OR" statement. I would prefer the "AND" matching like when given base matches and when given head matches the specified regex then add the label.

@deepakputhraya
Copy link
Author

deepakputhraya commented Nov 7, 2019

We should also discuss if the specified conditions would be combined in an "AND" or "OR" statement. I would prefer the "AND" matching like when given base matches and when given head matches the specified regex then add the label.

Apologies not being explicit. I just assumed the AND case with head & base fields.

Could you be so kind and specify what you mean with the ignore: ["develop"] configuration?

I would like to make a small correction

hotfix:
  base: master
  ignore_head: ["develop"] # changed from ignore to ignore_head

Ignore branches with specific names for this rule. This is probably possible to support with regex but the thought here was to make the rule more readable.

Do you think adding filter like PR size to this make sense? I understand that there are Github actions for this specific scenario, but providing PR size filter with base & head would make it more customizable.
Example:

hotfix:
  base: master
  head: "hotfix/*"
  max_line_changes: 10 

Assuming that it is AND across properties and OR within a property.

@amacado
Copy link
Contributor

amacado commented Nov 7, 2019

To be honest, in my opinion the ignore_head and max_line_changes options make this small and useful action pretty complicated. Specially the ignore_head option.

I agree that an optional base & master definition improves the customisation possibilities of this action, but I like to keep things simple. For compatibility reasons I suggest to keep this configuration valid:

hotfix: ["hotfix/*"]

same as

hotfix:
  head: ["hotfix/*"]

What is your opinion @TimonVS ?

@deepakputhraya
Copy link
Author

As long as we have sane default values or ignore fields that are not set it would still remain simple. Options such as max_line_changes & ignore_head would be used who require more control or have more specific needs. For an average user of the action, they would probably stick to the options that you mentioned.

@deepakputhraya
Copy link
Author

@TimonVS @amacado Any update on this guys?

@amacado
Copy link
Contributor

amacado commented Nov 11, 2019

@deepakputhraya feel free to fork and do a pull request :)

@TimonVS
Copy link
Owner

TimonVS commented Nov 12, 2019

Hey @deepakputhraya! Those are some good suggestions. I feel like we can add base and head options pretty easily. I think that ignore_head can be implemented by prefixing the head value with a !, this is supported by matcher.

I'm not entirely convinced that we should add the max_line_changes option currently. The consequence of adding this option is that the Action has to run for every push to a PR because the total lines changed can change every commit and if it goes below the threshold in a later, should we remove the label again?

Would you have time to work on this feature?

@deepakputhraya
Copy link
Author

@TimonVS @amacado I would love to. I can probably get to this in a few weeks if nobody has picked this up by then.

@VincentLanglet
Copy link

VincentLanglet commented Jun 3, 2022

I would really be interested by a way to automatically add a label based on the target branch.

For instance, I'd like to add automatically an hotfix label on every branch which target stable.

Did you tried somethihng @deepakputhraya ?

@gdostie
Copy link

gdostie commented Aug 15, 2022

Hello, I created a PR for it ➡️ #61

It only adds the head and base options since there seemed to be a consensus around them, and uses the AND operator when both options are used in combination.

@GermainBergeron
Copy link

@TimonVS

Any chance to get the above PR reviewed/released? It would definitely help us!

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

6 participants