]> source.dussan.org Git - gitea.git/commitdiff
[Patch] Fix closed PR also triggers Webhooks and actions (#23782) (#23834)
authorGiteabot <teabot@gitea.io>
Fri, 31 Mar 2023 06:29:23 +0000 (02:29 -0400)
committerGitHub <noreply@github.com>
Fri, 31 Mar 2023 06:29:23 +0000 (14:29 +0800)
Backport #23782 by @sillyguodong

Fix #23707
Cause by #23189
This PR is a quick fix that, when pushing commits to closed PR, webhook
and actions also be triggered.

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
services/pull/pull.go

index a5541b84606b2736f9450bf15d62f18333472359..73d7c571484c2cc63a08abdeab803ca1a0bda99f 100644 (file)
@@ -294,6 +294,10 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
                        }
                        if err == nil {
                                for _, pr := range prs {
+                                       if pr.Issue.IsClosed {
+                                               // The closed PR never trigger action or webhook
+                                               continue
+                                       }
                                        if newCommitID != "" && newCommitID != git.EmptySHA {
                                                changed, err := checkIfPRContentChanged(ctx, pr, oldCommitID, newCommitID)
                                                if err != nil {