-
Notifications
You must be signed in to change notification settings - Fork 61.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify CODEOWNERS syntax exceptions (#1551)
* Fix #1407 Say that a CODEOWNERS file follows most, but not all, gitignore syntax rules * More updates See #1407 (comment) * Fix link syntax oops! * Update content/github/creating-cloning-and-archiving-repositories/about-code-owners.md Co-authored-by: hubwriter <[email protected]> Co-authored-by: hubwriter <[email protected]>
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,9 @@ For code owners to receive review requests, the CODEOWNERS file must be on the b | |
|
||
### CODEOWNERS syntax | ||
|
||
A CODEOWNERS file uses a pattern that follows the same rules used in [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) files. The pattern is followed by one or more {% data variables.product.prodname_dotcom %} usernames or team names using the standard `@username` or `@org/team-name` format. You can also refer to a user by an email address that has been added to their {% data variables.product.product_name %} account, for example `[email protected]`. | ||
A CODEOWNERS file uses a pattern that follows most of the same rules used in [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) files, with [some exceptions](#syntax-exceptions). The pattern is followed by one or more {% data variables.product.prodname_dotcom %} usernames or team names using the standard `@username` or `@org/team-name` format. You can also refer to a user by an email address that has been added to their {% data variables.product.product_name %} account, for example `[email protected]`. | ||
|
||
If any line in your CODEOWNERS file contains invalid syntax, the file will not be detected and will not be used to request reviews. Invalid syntax includes inline comments and user or team names that do not exist on {% data variables.product.product_name %}. | ||
If any line in your CODEOWNERS file contains invalid syntax, the file will not be detected and will not be used to request reviews. | ||
#### Example of a CODEOWNERS file | ||
``` | ||
# This is a comment. | ||
|
@@ -83,6 +83,13 @@ apps/ @octocat | |
# subdirectories. | ||
/docs/ @doctocat | ||
``` | ||
#### Syntax exceptions | ||
There are some syntax rules for gitignore files that do not work in CODEOWNERS files: | ||
- Escaping a pattern starting with `#` using `\` so it is treated as a pattern and not a comment | ||
- Using `!` to negate a pattern | ||
- Using `[ ]` to define a character range | ||
|
||
|
||
|
||
### Further reading | ||
|
||
|