aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2025-03-13 19:36:14 -0700
committerGitHub <noreply@github.com>2025-03-13 19:36:14 -0700
commit1e7248047ce66c235faf53cd79b6513fb3aa1c50 (patch)
treea97bbdf8edc017be7e4365b36396da06442538c5 /services/repository
parentde2d472d90b1c563a432e27621cb455378b700f8 (diff)
downloadgitea-1e7248047ce66c235faf53cd79b6513fb3aa1c50.tar.gz
gitea-1e7248047ce66c235faf53cd79b6513fb3aa1c50.zip
Pull request updates will also trigger code owners review requests (#33744)
Fix #33490 It will only read the changed file on the pushed commits but not all the files of this PR. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/push.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/services/repository/push.go b/services/repository/push.go
index 0ea51f9c07..00d4fb11af 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -166,7 +166,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
branch := opts.RefFullName.BranchName()
if !opts.IsDelRef() {
log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)
- go pull_service.AddTestPullRequestTask(pusher, repo.ID, branch, true, opts.OldCommitID, opts.NewCommitID)
newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
if err != nil {
@@ -208,6 +207,17 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
log.Error("IsForcePush %s:%s failed: %v", repo.FullName(), branch, err)
}
+ // only update branch can trigger pull request task because the pull request hasn't been created yet when creaing a branch
+ go pull_service.AddTestPullRequestTask(pull_service.TestPullRequestOptions{
+ RepoID: repo.ID,
+ Doer: pusher,
+ Branch: branch,
+ IsSync: true,
+ IsForcePush: isForcePush,
+ OldCommitID: opts.OldCommitID,
+ NewCommitID: opts.NewCommitID,
+ })
+
if isForcePush {
log.Trace("Push %s is a force push", opts.NewCommitID)