Skip to content

Commit 1ad4bb9

Browse files
authored
Fix workflow trigger event bugs (#29467)
1. Fix incorrect `HookEventType` for issue-related events in `IssueChangeAssignee` 2. Add `case "types"` in the `switch` block in `matchPullRequestEvent` to avoid warning logs
1 parent 82405f8 commit 1ad4bb9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/actions/workflows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ func matchPullRequestEvent(gitRepo *git.Repository, commit *git.Commit, prPayloa
441441
// all acts conditions should be satisfied
442442
for cond, vals := range acts {
443443
switch cond {
444+
case "types":
445+
// types have been checked
446+
continue
444447
case "branches":
445448
refName := git.RefName(prPayload.PullRequest.Base.Ref)
446449
patterns, err := workflowpattern.CompilePatterns(vals...)

services/actions/notifier.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ func (n *actionsNotifier) IssueChangeAssignee(ctx context.Context, doer *user_mo
152152
} else {
153153
action = api.HookIssueAssigned
154154
}
155-
notifyIssueChange(ctx, doer, issue, webhook_module.HookEventPullRequestAssign, action)
155+
156+
hookEvent := webhook_module.HookEventIssueAssign
157+
if issue.IsPull {
158+
hookEvent = webhook_module.HookEventPullRequestAssign
159+
}
160+
161+
notifyIssueChange(ctx, doer, issue, hookEvent, action)
156162
}
157163

158164
// IssueChangeMilestone notifies assignee to notifiers

0 commit comments

Comments
 (0)