Protect the file on Github

fc3nerv
Jun 8, 2021

To protect the files/folder from unwanted change which bypassing the review process, we can use code owner feature to make sure every change on that files require approval from the code owner.

To use this feature you, you need to create a new file into the root folder / inside the .github. The file name is CODEOWNERS and consist of the following syntax;

directory/file username/email address

Moreover, the first username will be a global owner, and the order of syntax is important. The syntax format is similar like gitattributs.

Once you merged the file, go to your repository. Select Settings tab and choose Branches. Add rule or edit existing rules, and check require approval before merging. Then check require review from code owner.

--

--