labeler icon indicating copy to clipboard operation
labeler copied to clipboard

Follow CODEOWNERS file

Open Ayc0 opened this issue 3 years ago • 3 comments

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

Ayc0 avatar Jan 16 '23 20:01 Ayc0

hi @Ayc0, thank you for the report. We will take a look at it :)

panticmilos avatar Jan 17 '23 10:01 panticmilos

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.

OJFord avatar Nov 22 '23 14:11 OJFord

anything we can do here?

willcbaker avatar Feb 20 '24 20:02 willcbaker