This document describes how to use the code owner mechanism.
Open Project
1. Log in to the CODING Console and click the team domain name to go to CODING.
2. Click in the upper-right corner to open the project list page and click a project icon to open the corresponding project. 3. Select Code Repositories in the menu on the left and click Branches to go to the branch management page.
The code owner mechanism must be used together with Branch Protection. Place the declaration file CODEOWNERS
in a code repository to declare the owner of the code files in this repository. Generally, the code owner is the project owner. When the target branch of a merge request is a protected branch and the files changed in the request involve the paths or files set in the declaration file, the merge request details will list the corresponding owners and their review statuses.
In the figure above, the CODEOWNER
file declares that the owner of the files in the charts/repos/**
path is Sally. When a merge request is submitted for a protected branch and it involves changes to files in the chars/repos/
path, Sally is automatically added as a reviewer for this request.
In the protected branch settings, toggle on Enable Review by Code Owner. Then, code owners must Allow Merge for every merge request that changes code under their jurisdictions.
Declaration file URL
By default, CODEOWNERS
files are searched for layer by layer from the following locations. The file name must be in uppercase, and the search will stop when one file is found.
Root directory
docs/
directory
The declaration file is a normal text file. Blank lines and lines starting with #
are ignored. Each line uses the following format:
pattern email email email ...
pattern
indicates a file path mode. email is the owner's email. You can enter multiple owners separated by spaces. Sample file:
*.js yourname@coding.net
/build/logs/ yourname@coding.net
docs/* yourname@coding.net
/docs/ yourname@coding.net
Was this page helpful?