mirror of
https://gitea.com/gitea/docs.git
synced 2026-08-02 21:03:05 +00:00
Add documentation for code owner branch protection (#245)
Documentation for https://github.com/go-gitea/gitea/pull/34995 --------- Co-authored-by: bircni <bircni@icloud.com> Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com> Reviewed-on: https://gitea.com/gitea/docs/pulls/245 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: Naxdy <naxdy@naxdy.org>
This commit is contained in:
@@ -39,6 +39,9 @@ docs/(aws|google|azure)/[^/]*\\.(md|txt) @user8 @org1/team4
|
||||
!/assets/.*\\.(bin|exe|msi) @user9
|
||||
```
|
||||
|
||||
Code owners listed in this file will automatically be requested to review pull requests
|
||||
that modify files matching at least one corresponding rule.
|
||||
|
||||
### Escaping
|
||||
|
||||
You can escape characters `#`, ` ` (space) and `\` with `\`, like:
|
||||
@@ -55,3 +58,27 @@ Some character (`.+*?()|[]{}^$\`) should be escaped with `\\` inside regexp, lik
|
||||
path/\\.with\\.dots
|
||||
path/with\\+plus
|
||||
```
|
||||
|
||||
### Branch Protection Rules
|
||||
|
||||
When setting up branch protection rules, you may choose to enforce code owner approval of
|
||||
modified files. This will block a PR from being merged until at least one code owner
|
||||
has given approval for every applicable rule listed in the `CODEOWNERS` file.
|
||||
|
||||
For example, say you have the following `CODEOWNERS` file:
|
||||
|
||||
```bash
|
||||
.*\\.go @Bob
|
||||
.*\\.md @Sally @Chris
|
||||
migrations/.* @Alice
|
||||
```
|
||||
|
||||
This means that:
|
||||
|
||||
- If your PR modifies any `.go` files, it will require approval from Bob.
|
||||
- If your PR modifies any `.md` files, it will require approval from _either_ Sally _or_ Chris.
|
||||
- If your PR modifies any file in the `migrations` directory, it will require approval from Alice.
|
||||
|
||||
These rules are composable. So, for example, if your PR modifies some `.go` files, as well as
|
||||
some `.md` files, this means it will require approval from Bob, in addition to approval from
|
||||
one of either Sally or Chris.
|
||||
|
||||
Reference in New Issue
Block a user