From 6c89de494a1f6c0cbaf34efe7a18f310c408cd23 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 31 Dec 2024 20:08:36 +0800 Subject: [PATCH] feat(action): issue change title notifications (#33050) - Add `IssueChangeTitle` method to handle issue title changes - Add `notifyIssueChangeWithTitleOrContent` method to generalize notification handling for issue title or content changes action file as below: ```yaml name: Semantic Pull Request on: pull_request_target: types: [edited] ``` --------- Signed-off-by: Bo-Yi Wu Co-authored-by: Giteabot Co-authored-by: wxiaoguang --- services/actions/notifier.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/actions/notifier.go b/services/actions/notifier.go index a4ebdf9e88..67e33e7cce 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -58,7 +58,15 @@ func (n *actionsNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu // IssueChangeContent notifies change content of issue func (n *actionsNotifier) IssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) { ctx = withMethod(ctx, "IssueChangeContent") + n.notifyIssueChangeWithTitleOrContent(ctx, doer, issue) +} +func (n *actionsNotifier) IssueChangeTitle(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldTitle string) { + ctx = withMethod(ctx, "IssueChangeTitle") + n.notifyIssueChangeWithTitleOrContent(ctx, doer, issue) +} + +func (n *actionsNotifier) notifyIssueChangeWithTitleOrContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue) { var err error if err = issue.LoadRepo(ctx); err != nil { log.Error("LoadRepo: %v", err)