Code and repositories / Repository settings
Ask code owners to review with CODEOWNERS
A new pull request changes files in three parts of the code, and the author does not know who owns each part. Source reads your CODEOWNERS file, the same file as on GitHub, and asks the code owners of the changed files to review.
6 min read
A CODEOWNERS file from GitHub works as it is.
1. Put the file in the repository
Commit the file at one of these paths. Source reads the first one that it finds, in this order:
.source/CODEOWNERS.github/CODEOWNERSCODEOWNERS(at the root)docs/CODEOWNERS
To use a file on Source only, and keep the file for GitHub as it is, put it at .source/CODEOWNERS.
2. Write the rules
The syntax is the syntax of GitHub. Each line is a pattern, then its owners:
# The core team owns everything by default.
* @acme/core
# Ana owns the JavaScript files.
*.js @ana
# Ben and the docs team own the docs folder.
/docs/ @ben @acme/docs
# Nobody owns the generated files.
/docs/generated/
- The last rule that matches a file decides its owners. Put the general rules first, and the exact rules after them.
- A rule with no owners removes the owners of its files.
- A line that starts with
#is a comment. - To put a space in a pattern, write
\.
A pattern works as in a .gitignore file. See Patterns for examples.
3. Name people and teams
An owner is one of these:
- A person:
@ana, the username of a Source account. - A team:
@acme/core, a team of the organization that owns the repository. The team stands for its members.
A username that has no Source account is an error. A team of another organization is an error too. The other owners of that rule still count.
A person counts as an owner only with the triage role or more on the repository. Without it, the person shows with an Inactive badge. Source does not ask an inactive person to review, and the Assign agent does not pick them.
Note
Only the members of the organization see who is in a team. Other people see the name of the team only.
4. Look at the rules and the errors
- Open the repository, then Settings, then Experts under People.
- Scroll to Code owners, under the expert entries.
- Read the rules. Each rule shows its line, its pattern and its owners.
- If the file has errors, a box above the rules lists them, each with its line.

The page reads the file of the default branch. Fix an error with a commit, as for any other file.
In a terminal, use src:
src codeowners list
src codeowners errors
Everyone who can read the repository can read its code owners.
Done
- New pull requests ask the right people to review, with no work by the author.
- The Code owners section of Settings, Experts shows each rule and each error of the file.
src codeowners errorsshows the same errors in a terminal.- The Assign agent picks from your code owners and your experts.
- The file list shows the files of one owner.
What Source does with the file
It asks the code owners to review
When a person opens a pull request on Source, the bot asks the code owners of the changed files to review it. The timeline shows the request.
- Source reads the CODEOWNERS file of the base branch of the pull request.
- A team rule asks each active member of the team.
- Source never asks the author, or a person without the triage role.
- A pull request has at most 25 review requests. When there is less room, Source asks the first owners by username.
- Source only adds requests. It does not remove a request that a person removed.

A draft gets its requests when it becomes ready for review. A pull request that screening holds gets them when a maintainer shows it.
Source does not ask again when someone pushes to an open pull request. These pull requests get no requests:
- A pull request from an import or from GitHub sync.
- A pull request with too many changed files to list.
It gives the owners to the Assign agent
The Assign agent picks people from the experts and the code owners of the default branch. For a pull request, it gets the changed files that each person owns. See Write down who knows what.
It filters the code by owner
The Filter button above the file list has an Owner field. Pick a person or a team to see only their files. See Filter by owner.
Reference
Patterns
| Pattern | What it matches |
|---|---|
*.js | Each .js file, in all folders |
apps/ | Each folder with the name apps, in all folders, and all the files below it |
/docs/ | The docs folder at the root, and all the files below it |
docs/* | The files directly in docs, but not the files in its subfolders |
/src/app.ts | The one file src/app.ts |
- A pattern with no
/before its end matches at all levels. - A pattern with a
/at the start or in the middle starts at the root of the repository.
These do not work, the same as on GitHub. Each one is an error:
!at the start of a pattern[ ]in a pattern- An email as an owner
Limits
Source reads a file of up to 3 MB, with up to 5,000 rules and 200 different owners.
src, REST and MCP
- Add
--json line,pattern,ownerstosrc codeowners list, or--json line,column,kind,message,sourcetosrc codeowners errors, for JSON. - Outside a clone of the repository, add
-R OWNER/REPO. - REST is
GET /api/v1/repos/{owner}/{repo}/codeowners(the file path, the rules and the errors) andGET .../codeowners/errors(the errors, in the fields of GitHub). - The MCP tool is
list_code_owners.