Can you set team members to only commit to files they're codeowners of?

I have a repository, where I keep translations of my bot available, so that others can contribute their own language to it, fix typos, etc.

I want those people to have more easy access to updating files, which is why I add them to a translator team, which has access to the repository.

My question now: Can you somehow restrict those people to only be able to commit changes to files they’re codeowners of?

Like that when a member is codeowner of it.json, that they can commit changes, instead of having to make a PR, but when they would try to make changes to en.json, that it would force them to PR it instead?

1 Like

Hi @andre601,

Thank you for being here! Each CODEOWNERS file assigns the code owners for a single branch in the repository. Thus, you can assign different code owners for different branches, such as @octo-org/codeowners-team for a code base on the master branch and @octocat for a GitHub Pages site on the gh-pages branch.

Thanks for the answer,

Sadly does this not quite answer the question I had. I want to restrict what team members can do, based on what files they’re code-owners of (e.g. if User A is code-owner of file it.json, that they could just push changes to it, but require to open a PR for every other file.)

In addition, would I prefer to not have several branches open, to keep the repository organized and not have possibly outdated branches.