Skip to content

Commit

Permalink
Fix workflow trigger event bugs (#29467)
Browse files Browse the repository at this point in the history
1. Fix incorrect `HookEventType` for issue-related events in
`IssueChangeAssignee`
2. Add `case "types"` in the `switch` block in `matchPullRequestEvent`
to avoid warning logs
  • Loading branch information
Zettat123 authored and GiteaBot committed Feb 28, 2024
1 parent 222f938 commit 39437f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions modules/actions/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
8 changes: 7 additions & 1 deletion services/actions/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39437f8

Please sign in to comment.