]> source.dussan.org Git - gitea.git/commitdiff
Fix workflow trigger event IssueChangeXXX bug (#29559) (#29565)
authorGiteabot <teabot@gitea.io>
Sun, 3 Mar 2024 20:34:46 +0000 (04:34 +0800)
committerGitHub <noreply@github.com>
Sun, 3 Mar 2024 20:34:46 +0000 (04:34 +0800)
Backport #29559 by @yp05327

Bugs from #29308
Follow #29467

partly fix #29558

Co-authored-by: yp05327 <576951401@qq.com>
services/actions/notifier.go

index 524ce08dbafa612ae12daf478db8b74867c4323c..a55b18fe98fec3b1c894354b77b62696f4583f3c 100644 (file)
@@ -172,14 +172,26 @@ func (n *actionsNotifier) IssueChangeMilestone(ctx context.Context, doer *user_m
        } else {
                action = api.HookIssueDemilestoned
        }
-       notifyIssueChange(ctx, doer, issue, webhook_module.HookEventPullRequestMilestone, action)
+
+       hookEvent := webhook_module.HookEventIssueMilestone
+       if issue.IsPull {
+               hookEvent = webhook_module.HookEventPullRequestMilestone
+       }
+
+       notifyIssueChange(ctx, doer, issue, hookEvent, action)
 }
 
 func (n *actionsNotifier) IssueChangeLabels(ctx context.Context, doer *user_model.User, issue *issues_model.Issue,
        _, _ []*issues_model.Label,
 ) {
        ctx = withMethod(ctx, "IssueChangeLabels")
-       notifyIssueChange(ctx, doer, issue, webhook_module.HookEventPullRequestLabel, api.HookIssueLabelUpdated)
+
+       hookEvent := webhook_module.HookEventIssueLabel
+       if issue.IsPull {
+               hookEvent = webhook_module.HookEventPullRequestLabel
+       }
+
+       notifyIssueChange(ctx, doer, issue, hookEvent, api.HookIssueLabelUpdated)
 }
 
 func notifyIssueChange(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, event webhook_module.HookEventType, action api.HookIssueAction) {