Skip to content

It's not possible to label a PR if the head branch matches a list of regexes #914

@ludwiggj

Description

@ludwiggj

Description:

I'd like to ability to apply a label only if the head branch matches all of the regexes in a list. This is typically because the first regex says the head branch must match a pattern, but the second regex says that the head branch should not match a different pattern i.e. exceptions to the first regex.

For example,

scala-steward:
- all:
  - head-branch: ['^update\/.+', '^(?!^update\/user-service-gen$)']

Or another alternative, permit multiple head-branch's under the all condition:

scala-steward:
- all:
  - head-branch: ['^update\/.+']
  - head-branch: ['^(?!^update\/user-service-gen$)']

Another option, mirroring the all and any glob operators, would be to introduce a new all-head-branch operator, and rename the existing operator to any-head-branch.

scala-steward:
- all:
  - all-head-branch: ['^update\/.+', '^(?!^update\/user-service-gen$)']

I have tested the first two options above, and in both cases it operates as the "any" logic i.e. a PR with head branch update/user-service-gen was labelled as it matched on the first regex condition. The second regex was not tested.

Justification:
Useful if you want to apply a label where the head-branch matches a regex, but with given exceptions.
It might be possible to do this within a single regex, but this feature would enable such functionality to be more easily understood.

Are you willing to submit a PR?
No, as I'm not a typescript developer, but I'd happily submit a PR to update the README if the feature was implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions