-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add codeowners feature #24910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add codeowners feature #24910
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
882d97a
Add codeowners feature
cl-bvl c8eb310
Merge branch 'main' into feature/code_owners
cl-bvl 56803ca
Fix bugs
cl-bvl e6bdaa2
Fix
cl-bvl d68546a
Merge branch 'main' into feature/code_owners
cl-bvl b7ec465
Update modules/git/repo_show.go
cl-bvl 7136afe
Fixes
cl-bvl c7d71a8
Fix doc
cl-bvl d3d4732
Add file verify
cl-bvl dba89f1
Revert
cl-bvl b679754
Add WIP support
cl-bvl 8286142
Merge branch 'main' into feature/code_owners
cl-bvl a801f70
Fixes
cl-bvl ad0a3a5
Fixes
cl-bvl 291aca7
Merge branch 'main' into feature/code_owners
cl-bvl 76b86ef
Add tests
cl-bvl 1b80b88
Merge branch 'feature/code_owners' of github.com:WinnerSoftLab/gitea …
cl-bvl a1364f3
Merge branch 'feature/code_owners' of github.com:WinnerSoftLab/gitea …
lunny 7ddd654
Fix lint
lunny ae05469
Merge pull request #1 from lunny/WinnerSoftLab-feature/code_owners
cl-bvl 81e6616
Merge branch 'main' into feature/code_owners
cl-bvl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
date: "2023-05-24T16:00:00+00:00" | ||
title: "Code Owners" | ||
slug: "code-owners" | ||
weight: 30 | ||
toc: false | ||
draft: false | ||
aliases: | ||
- /en-us/code-owners | ||
menu: | ||
sidebar: | ||
parent: "usage" | ||
name: "Code Owners" | ||
weight: 30 | ||
identifier: "code-owners" | ||
--- | ||
|
||
# Code Owners | ||
|
||
Gitea maintains code owner files. It looks for it in the following locations in this order: | ||
|
||
- `./CODEOWNERS` | ||
- `./docs/CODEOWNERS` | ||
- `./.gitea/CODEOWNERS` | ||
|
||
And stops at the first found file. | ||
|
||
Example file: | ||
|
||
``` | ||
.*\\.go @user1 @user2 # This is comment | ||
|
||
# Comment too | ||
# You can assigning code owning for users or teams | ||
frontend/src/.*\\.js @org1/team1 @org1/team2 | ||
|
||
# You can use negative pattern | ||
!frontend/src/.* @org1/team3 @user5 | ||
|
||
# You can use power of go regexp | ||
docs/(aws|google|azure)/[^/]*\\.(md|txt) @user8 @org1/team4 | ||
!/assets/.*\\.(bin|exe|msi) @user9 | ||
``` | ||
|
||
### Escaping | ||
|
||
You can escape characters `#`, ` ` (space) and `\` with `\`, like: | ||
|
||
``` | ||
/dir/with\#hashtag @user1 | ||
/path\ with\ space @user2 | ||
/path/with\\backslash @user3 | ||
``` | ||
|
||
Some character (`.+*?()|[]{}^$\`) should be escaped with `\\` inside regexp, like: | ||
|
||
``` | ||
/path/\\.with\\.dots | ||
/path/with\\+plus | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package git | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// GetFileContent returns file content for given revision. | ||
func (repo *Repository) GetFileContent(rev, path string) ([]byte, error) { | ||
cmd := NewCommand(repo.Ctx, "show") | ||
cmd.AddDynamicArguments(fmt.Sprintf("%s:%s", rev, path)) | ||
stdout, _, err := cmd.RunStdBytes(&RunOpts{Dir: repo.Path}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return stdout, nil | ||
} | ||
cl-bvl marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.