Follow CODEOWNERS file
Description:
Add the option to use the CODEOWNERS (+ a file that map some codeowners to labels) to the labeler
For instance:
# Add 'repo' label to any root file changes
repo:
- '*'
# Add '@domain/core' label to any change within the 'core' package
'@domain/core':
- package/core/*
- package/core/**/*
# Add 'test' label to any change to *.spec.js files within the source dir
test:
- src/**/*.spec.js
# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
source:
- any: ['src/**/*', '!src/docs/*']
# Add 'frontend` label to any change to *.js files as long as the `main.js` hasn't changed
frontend:
- any: ['src/**/*.js']
all: ['!src/main.js']
# HERE IS THE ADDITION
# Add 'label-from-codeowner' label that gets added when the owner '@name-of-the-owner' gets pinged on a PR
label-from-codeowner:
- codeowner: @name-of-the-owner
# or could be follow multiple owners
codeowners: ['@name-of-the-owner']
Justification:
In project with teams, codeowners is a great feature to get pinged, but it cannot really help to view afterwards which teams were pinged by a PR (as the team gets replaced by the person that reviewed the PR).
To fix this, I use labels with a similar subset of the CODEOWNERS config. But sometimes it can be a bit tricky to find the perfect equivalent for the CODEOWNERS syntax using glob pattern.
Are you willing to submit a PR?
Yes, if this PR is approved, I can work on a PR for that
hi @Ayc0, thank you for the report. We will take a look at it :)
This would be great.
Just to add a slightly different/the other direction use case: if you use labeller for say team/x labels, then if you want to use CODEOWNERS as well you have to duplicate all the paths and what they map to. That is, even without any mismatch in syntax or what the different path specifiers might be capable of, it's a shame to need this duplication.
anything we can do here?