diff options
author | Giteabot <teabot@gitea.io> | 2023-06-12 05:08:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-12 17:08:09 +0800 |
commit | 5ff0f7d0caa5ff1d84613a17dfacd60615b277ef (patch) | |
tree | 8dd6480704298ab423c2f8c2d91ddccadc4ee319 | |
parent | 224ee0d4e539510b82125876684e9f9c5fde0dfb (diff) | |
download | gitea-5ff0f7d0caa5ff1d84613a17dfacd60615b277ef.tar.gz gitea-5ff0f7d0caa5ff1d84613a17dfacd60615b277ef.zip |
Add `WithPullRequest` for `actionsNotifier` (#25144) (#25197)
Backport #25144 by @Zettat123
Fix #25093
If
[`WithPullRequest`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L90-L96)
is not called, the `Ref` in
[`notifyInput`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L55-L65)
will be empty, so the workflows in the head branch will not be found and
triggered.
-rw-r--r-- | services/actions/notifier.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/actions/notifier.go b/services/actions/notifier.go index 48eec5283b..536b430b41 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -81,6 +81,7 @@ func (n *actionsNotifier) NotifyIssueChangeStatus(ctx context.Context, doer *use newNotifyInputFromIssue(issue, webhook_module.HookEventPullRequest). WithDoer(doer). WithPayload(apiPullRequest). + WithPullRequest(issue.PullRequest). Notify(ctx) return } @@ -136,6 +137,7 @@ func (n *actionsNotifier) NotifyIssueChangeLabels(ctx context.Context, doer *use Repository: convert.ToRepo(ctx, issue.Repo, perm_model.AccessModeNone), Sender: convert.ToUser(ctx, doer, nil), }). + WithPullRequest(issue.PullRequest). Notify(ctx) return } @@ -160,6 +162,10 @@ func (n *actionsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *us mode, _ := access_model.AccessLevel(ctx, doer, repo) if issue.IsPull { + if err := issue.LoadPullRequest(ctx); err != nil { + log.Error("LoadPullRequest: %v", err) + return + } newNotifyInputFromIssue(issue, webhook_module.HookEventPullRequestComment). WithDoer(doer). WithPayload(&api.IssueCommentPayload{ @@ -170,6 +176,7 @@ func (n *actionsNotifier) NotifyCreateIssueComment(ctx context.Context, doer *us Sender: convert.ToUser(ctx, doer, nil), IsPull: true, }). + WithPullRequest(issue.PullRequest). Notify(ctx) return } |