Skip to content

Commit c25a16e

Browse files
committed
fix: PushToBaseRepo first
1 parent e88b529 commit c25a16e

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Diff for: services/pull/pull.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,24 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
263263
return
264264
}
265265

266+
for _, pr := range prs {
267+
log.Trace("Updating PR[%d]: composing new test task", pr.ID)
268+
if pr.Flow == issues_model.PullRequestFlowGithub {
269+
if err := PushToBaseRepo(ctx, pr); err != nil {
270+
log.Error("PushToBaseRepo: %v", err)
271+
continue
272+
}
273+
} else {
274+
continue
275+
}
276+
277+
AddToTaskQueue(pr)
278+
comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID)
279+
if err == nil && comment != nil {
280+
notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment)
281+
}
282+
}
283+
266284
if isSync {
267285
requests := issues_model.PullRequestList(prs)
268286
if err = requests.LoadAttributes(); err != nil {
@@ -304,24 +322,6 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
304322
}
305323
}
306324

307-
for _, pr := range prs {
308-
log.Trace("Updating PR[%d]: composing new test task", pr.ID)
309-
if pr.Flow == issues_model.PullRequestFlowGithub {
310-
if err := PushToBaseRepo(ctx, pr); err != nil {
311-
log.Error("PushToBaseRepo: %v", err)
312-
continue
313-
}
314-
} else {
315-
continue
316-
}
317-
318-
AddToTaskQueue(pr)
319-
comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID)
320-
if err == nil && comment != nil {
321-
notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment)
322-
}
323-
}
324-
325325
log.Trace("AddTestPullRequestTask [base_repo_id: %d, base_branch: %s]: finding pull requests", repoID, branch)
326326
prs, err = issues_model.GetUnmergedPullRequestsByBaseInfo(repoID, branch)
327327
if err != nil {

0 commit comments

Comments
 (0)