Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CODEOWNERS to automatically add approvers

Tags:

gitlab

I love GitLab, but I am frustrated to assign approvers manually for each Merge Request. Gitlab friendly suggest to Tip: add a CODEOWNERS to automatically add approvers based on file paths and file types. And so I did , I have created a file under : .gitlab/docs/CODEOWNERS.txt Here is the contents of my file :

Multiple codeowners can be specified, separated by whitespace

CODEOWNERS @eduardo.baiao @n.belokopytov @viacheslav.iankovyi @yan.braslavsky

But unfortunately it does not auto assigns reviewers during Merge Requests. Did I do something wrong ? Am I missing something ?

like image 248
Ivelius Avatar asked Oct 15 '25 05:10

Ivelius


1 Answers

Assigning approvers based on a CODEOWNERS file requires either GitLab Premium or GitLab Silver (or higher).

  • According to the Code Owners documentation, the CODEOWNERS file should be placed in either .gitlab/ or docs/ or the root directory. I don't think it will find it in .gitlab/docs.
  • Additionally, the docs specify that the file should be named CODEOWNERS, not CODEOWNERS.txt. Try removing the .txt extension and see if it works.
  • Make sure that you have "Require approval from code owners" enabled in Settings -> General -> Merge Request Approvals. Merge Request Approvals
like image 148
Jonathan.Taylor Avatar answered Oct 18 '25 01:10

Jonathan.Taylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!