mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 04:45:02 +02:00
pull request updates will also trigger code owners review requests
This commit is contained in:
parent
8362a41559
commit
f0dd070ef1
@ -92,8 +92,12 @@ func ChangeTitle(ctx context.Context, issue *issues_model.Issue, doer *user_mode
|
|||||||
|
|
||||||
var reviewNotifiers []*ReviewRequestNotifier
|
var reviewNotifiers []*ReviewRequestNotifier
|
||||||
if issue.IsPull && issues_model.HasWorkInProgressPrefix(oldTitle) && !issues_model.HasWorkInProgressPrefix(title) {
|
if issue.IsPull && issues_model.HasWorkInProgressPrefix(oldTitle) && !issues_model.HasWorkInProgressPrefix(title) {
|
||||||
|
if err := issue.LoadPullRequest(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
reviewNotifiers, err = PullRequestCodeOwnersReview(ctx, issue, issue.PullRequest)
|
reviewNotifiers, err = PullRequestCodeOwnersReview(ctx, issue.PullRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("PullRequestCodeOwnersReview: %v", err)
|
log.Error("PullRequestCodeOwnersReview: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -40,17 +40,17 @@ type ReviewRequestNotifier struct {
|
|||||||
ReviewTeam *org_model.Team
|
ReviewTeam *org_model.Team
|
||||||
}
|
}
|
||||||
|
|
||||||
func PullRequestCodeOwnersReview(ctx context.Context, issue *issues_model.Issue, pr *issues_model.PullRequest) ([]*ReviewRequestNotifier, error) {
|
func PullRequestCodeOwnersReview(ctx context.Context, pr *issues_model.PullRequest) ([]*ReviewRequestNotifier, error) {
|
||||||
files := []string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}
|
if err := pr.LoadIssue(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
issue := pr.Issue
|
||||||
if pr.IsWorkInProgress(ctx) {
|
if pr.IsWorkInProgress(ctx) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pr.LoadHeadRepo(ctx); err != nil {
|
if err := pr.LoadHeadRepo(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pr.LoadBaseRepo(ctx); err != nil {
|
if err := pr.LoadBaseRepo(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -71,6 +71,7 @@ func PullRequestCodeOwnersReview(ctx context.Context, issue *issues_model.Issue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var data string
|
var data string
|
||||||
|
files := []string{"CODEOWNERS", "docs/CODEOWNERS", ".gitea/CODEOWNERS"}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if blob, err := commit.GetBlobByPath(file); err == nil {
|
if blob, err := commit.GetBlobByPath(file); err == nil {
|
||||||
data, err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
|
data, err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
|
||||||
|
@ -176,7 +176,7 @@ func NewPullRequest(ctx context.Context, opts *NewPullRequestOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !pr.IsWorkInProgress(ctx) {
|
if !pr.IsWorkInProgress(ctx) {
|
||||||
reviewNotifiers, err = issue_service.PullRequestCodeOwnersReview(ctx, issue, pr)
|
reviewNotifiers, err = issue_service.PullRequestCodeOwnersReview(ctx, pr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -453,6 +453,15 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !pr.IsWorkInProgress(ctx) {
|
||||||
|
reviewNotifiers, err := issue_service.PullRequestCodeOwnersReview(ctx, pr)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("PullRequestCodeOwnersReview: %v", err)
|
||||||
|
} else {
|
||||||
|
issue_service.ReviewRequestNotify(ctx, pr.Issue, doer, reviewNotifiers)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
notify_service.PullRequestSynchronized(ctx, doer, pr)
|
notify_service.PullRequestSynchronized(ctx, doer, pr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user