From 013f6de4b22c4cd4fc5675c8c12ee05884ed161b Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Wed, 28 Feb 2024 17:10:01 +0800 Subject: [PATCH 1/3] assign correct HookEventType for issues --- services/actions/notifier.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/actions/notifier.go b/services/actions/notifier.go index e144484dabda2..eaf87d516c690 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -152,7 +152,15 @@ func (n *actionsNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo } else { action = api.HookIssueAssigned } - notifyIssueChange(ctx, doer, issue, webhook_module.HookEventPullRequestAssign, action) + + var hookEvent webhook_module.HookEventType + if issue.IsPull { + hookEvent = webhook_module.HookEventPullRequestAssign + } else { + hookEvent = webhook_module.HookEventIssueAssign + } + + notifyIssueChange(ctx, doer, issue, hookEvent, action) } // IssueChangeMilestone notifies assignee to notifiers From 61c62864a94b2153bf1026cf74872bfe72d73f8a Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Wed, 28 Feb 2024 17:17:52 +0800 Subject: [PATCH 2/3] add 'types' case --- modules/actions/workflows.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go index 2db4a9296f0e8..595fd8bbb071b 100644 --- a/modules/actions/workflows.go +++ b/modules/actions/workflows.go @@ -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...) From b83fb87494249964f41d817fbf9b934080f96032 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Wed, 28 Feb 2024 17:49:35 +0800 Subject: [PATCH 3/3] apply patch --- services/actions/notifier.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/actions/notifier.go b/services/actions/notifier.go index eaf87d516c690..1e99c51a8b023 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -153,11 +153,9 @@ func (n *actionsNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo action = api.HookIssueAssigned } - var hookEvent webhook_module.HookEventType + hookEvent := webhook_module.HookEventIssueAssign if issue.IsPull { hookEvent = webhook_module.HookEventPullRequestAssign - } else { - hookEvent = webhook_module.HookEventIssueAssign } notifyIssueChange(ctx, doer, issue, hookEvent, action)