labeler
labeler copied to clipboard
[Feature] Naming labels based on regex capture groups
This feature request is for the ability to use regex capture groups to name the labels dynamically.
Imagine the following repository folder structure and I want all PR's to have an area/<area> label, which value should be based on the subfolder that the PR brings changes to.
k8s/ingress/...
k8s/rbac/...
k8s/config/...
k8s/dns/...
k8s/istio/...
network/...
Currently, I need to configure each possible label manually:
labels:
- label: "area/k8s-ingress"
files:
- "k8s/ingress/.*"
- label: "area/k8s-rbac"
files:
- "k8s/rbac/.*"
- label: "area/k8s-config"
files:
- "k8s/config/.*"
- label: "area/k8s-dns"
files:
- "k8s/dns/.*"
- label: "area/k8s-istio"
files:
- "k8s/istio/.*"
- label: "area/network"
files:
- "network/.*"
With the ability to use regex capture groups to name the labels dynamically, my configuration could be reduced to:
labels:
- label: "area/k8s-$1"
files:
- "k8s/(.*)/.*"
- label: "area/network"
files:
- "network/.*"
Nice to see that your back at it and releasing new features @srvaroa 🔥We love this project in our team.
Thanks @illrill, glad you're finding it useful. Looks like a good feature!