diff --git a/services/pull/pull.go b/services/pull/pull.go index 4f68a3084c..cba94a711f 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -128,13 +128,6 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *iss return err } - if !pr.IsWorkInProgress(ctx) { - reviewNotifiers, err = issue_service.PullRequestCodeOwnersReview(ctx, issue, pr) - if err != nil { - return err - } - } - if pr.Flow == issues_model.PullRequestFlowGithub { devLinks, err := issues_model.FindDevLinksByBranch(ctx, issue.RepoID, pr.HeadRepoID, pr.HeadBranch) if err != nil { @@ -152,7 +145,6 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *iss } } - // leave creating comment last compareInfo, err := baseGitRepo.GetCompareInfo(pr.BaseRepo.RepoPath(), git.BranchPrefix+pr.BaseBranch, pr.GetGitRefName(), false, false) if err != nil { @@ -186,6 +178,13 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, issue *iss return err } + if !pr.IsWorkInProgress(ctx) { + reviewNotifiers, err = issue_service.PullRequestCodeOwnersReview(ctx, issue, pr) + if err != nil { + return err + } + } + return nil }); err != nil { // cleanup: this will only remove the reference, the real commit will be clean up when next GC