]> source.dussan.org Git - gitea.git/commitdiff
Fix workflow trigger event bugs (#29467) (#29475)
authorGiteabot <teabot@gitea.io>
Wed, 28 Feb 2024 20:24:51 +0000 (04:24 +0800)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2024 20:24:51 +0000 (21:24 +0100)
Backport #29467 by @Zettat123

1. Fix incorrect `HookEventType` for issue-related events in
`IssueChangeAssignee`
2. Add `case "types"` in the `switch` block in `matchPullRequestEvent`
to avoid warning logs

Co-authored-by: Zettat123 <zettat123@gmail.com>
modules/actions/workflows.go
services/actions/notifier.go

index 2db4a9296f0e834c7aad2efbb33cd05abdc016bf..595fd8bbb071b9cd857f54eb40ab4942f7aaecfc 100644 (file)
@@ -441,6 +441,9 @@ func matchPullRequestEvent(gitRepo *git.Repository, commit *git.Commit, prPayloa
        // all acts conditions should be satisfied
        for cond, vals := range acts {
                switch cond {
+               case "types":
+                       // types have been checked
+                       continue
                case "branches":
                        refName := git.RefName(prPayload.PullRequest.Base.Ref)
                        patterns, err := workflowpattern.CompilePatterns(vals...)
index 87ffa6669918d33d049d7b1ec53a3319d18953f5..524ce08dbafa612ae12daf478db8b74867c4323c 100644 (file)
@@ -153,7 +153,13 @@ func (n *actionsNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo
        } else {
                action = api.HookIssueAssigned
        }
-       notifyIssueChange(ctx, doer, issue, webhook_module.HookEventPullRequestAssign, action)
+
+       hookEvent := webhook_module.HookEventIssueAssign
+       if issue.IsPull {
+               hookEvent = webhook_module.HookEventPullRequestAssign
+       }
+
+       notifyIssueChange(ctx, doer, issue, hookEvent, action)
 }
 
 // IssueChangeMilestone notifies assignee to notifiers