Github CODEOWNERS Syntax - Name included in directory?

1.2k Views Asked by At

In Github CODEOWNERS, I want to set a rule for "directories that contains the word <TEAM_NAME>".

I assume it'd be something like this if possible: src/**<TEAM_NAME>**/**


For example, if I have such directory structure:

src/
  index.js
  features/
    auth/
    sales-feature1/
    sales-feature2/
    marketing-feature1/
    marketing-feature2/
    marketing-feature3/
  utils/
    sales-util1/
    sales-util2/

I want to set CODEOWNERS like:

src/**sales**/**   @github-sales-team

Which will apply to the below files

src/features/sales-feature1/**
src/features/sales-feature2/**
src/utils/sales-util1/**
src/utils/sales-util2/*

Question: What to set for src/**sales**/** to achieve this?

1

There are 1 best solutions below

2
On

Seems CODEOWNERS follows .gitigonore rule with some exceptions

And the following link from other is helpful

When to use ** (double star) in glob syntax within JAVA

gitignore rule

exception rule in CODEOWNERS file