Use a CODEOWNERS file to define individuals or teams that are responsible for code in a repository.
Code owners are automatically requested for review when someone opens a pull request that modifies code that they own. When someone with admin permissions has enabled required reviews, they can optionally require approval from a code owner.
To use a CODEOWNERS file, create a new file called CODEOWNERS in the root,
.github/ directory of the repository.
A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files. The pattern is followed by one or more GitHub usernames or team names using the standard
@org/team-name format. You can also refer to a user by an email address that has been added to their GitHub account, for example
CODEOWNERS file example:
# This is a comment. # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in the repo. # Unless a later match takes precedence, @global-owner1 and @global-owner2 # will be requested for review when someone opens a pull request. * @global-owner1 @global-owner2 # Order is important; the last matching pattern takes the most precedence. # When someone opens a pull request that only modifies JS files, only @js-owner # and not the global owner(s) will be requested for a review. *.js @js-owner # You can also use email addresses if you prefer. They'll be used to look up # users just like we do for commit author emails. docs/* firstname.lastname@example.org