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

Follow CODEOWNERS file #483

Open
Ayc0 opened this issue Jan 16, 2023 · 3 comments
Open

Follow CODEOWNERS file #483

Ayc0 opened this issue Jan 16, 2023 · 3 comments
Labels
feature request New feature or request to improve the current logic needs eyes

Comments

@Ayc0
Copy link

Ayc0 commented Jan 16, 2023

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 Ayc0 added feature request New feature or request to improve the current logic needs triage labels Jan 16, 2023
@panticmilos
Copy link
Contributor

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

@OJFord
Copy link

OJFord commented Nov 22, 2023

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.

@willcbaker
Copy link

anything we can do here?

idryomov added a commit to idryomov/ceph that referenced this issue Apr 23, 2024
With actions/labeler#483 still pending, do it
manually.

A couple of entries matching both files and directories were expanded
since, unlike fnmatch(3), minimatch treats slashes specially:

- src/include/rbd* -> src/include/rbd* src/include/rbd/**
- src/rbd*         -> src/rbd* src/rbd*/**
- src/test/rbd*    -> src/test/rbd* src/test/rbd*/**

A bunch of entries under src/tools were combined into:

- src/tools/rbd*/**

Signed-off-by: Ilya Dryomov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic needs eyes
Projects
None yet
Development

No branches or pull requests

6 participants
@OJFord @willcbaker @Ayc0 @MaksimZhukov @panticmilos and others