From 47c9581a8017ddaa03c2e67ed8ccf80c3ba1c673 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 4 Nov 2024 20:42:20 -0800 Subject: [PATCH] Fix bug --- services/automerge/automerge.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/automerge/automerge.go b/services/automerge/automerge.go index b280444ca7..8cb3af0b50 100644 --- a/services/automerge/automerge.go +++ b/services/automerge/automerge.go @@ -24,6 +24,7 @@ import ( "code.gitea.io/gitea/modules/queue" notify_service "code.gitea.io/gitea/services/notify" pull_service "code.gitea.io/gitea/services/pull" + repo_service "code.gitea.io/gitea/services/repository" ) // prAutoMergeQueue represents a queue to handle update pull request tests @@ -303,4 +304,10 @@ func handlePullRequestAutoMerge(pullID int64, sha string) { // on the pull request page. But this should not be finished in a bug fix PR which will be backport to release branch. return } + + if pr.Flow == issues_model.PullRequestFlowGithub && scheduledPRM.DeleteBranchAfterMerge { + if err := repo_service.DeleteBranch(ctx, doer, pr.HeadRepo, headGitRepo, pr.HeadBranch); err != nil { + log.Error("deleteBranch after automerge for pull[%d] failed: %v", pr.ID, err) + } + } }