aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorVladimir Buyanov <81759784+cl-bvl@users.noreply.github.com>2023-06-08 11:56:05 +0300
committerGitHub <noreply@github.com>2023-06-08 16:56:05 +0800
commit3bdd48016f659c440d6e8bb57386fab7ad7b357b (patch)
tree7cf65016a18ce0e3d0e96e29838d40008f4306fe /routers
parentb5a2bb9ab347fb5aaa6c6ca95dfd1b31751f1fba (diff)
downloadgitea-3bdd48016f659c440d6e8bb57386fab7ad7b357b.tar.gz
gitea-3bdd48016f659c440d6e8bb57386fab7ad7b357b.zip
Add codeowners feature (#24910)
Hello. This PR adds a github like configuration for the CODEOWNERS file. Resolves: #10161
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/view.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 2fd893f91c..1d54f25884 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -21,6 +21,7 @@ import (
asymkey_model "code.gitea.io/gitea/models/asymkey"
"code.gitea.io/gitea/models/db"
git_model "code.gitea.io/gitea/models/git"
+ issue_model "code.gitea.io/gitea/models/issues"
repo_model "code.gitea.io/gitea/models/repo"
unit_model "code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
@@ -361,6 +362,13 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
if workFlowErr != nil {
ctx.Data["FileError"] = ctx.Locale.Tr("actions.runs.invalid_workflow_helper", workFlowErr.Error())
}
+ } else if util.SliceContains([]string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}, ctx.Repo.TreePath) {
+ if data, err := blob.GetBlobContent(); err == nil {
+ _, warnings := issue_model.GetCodeOwnersFromContent(ctx, data)
+ if len(warnings) > 0 {
+ ctx.Data["FileWarning"] = strings.Join(warnings, "\n")
+ }
+ }
}
isDisplayingSource := ctx.FormString("display") == "source"