aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2024-12-31 20:08:36 +0800
committerGitHub <noreply@github.com>2024-12-31 12:08:36 +0000
commit6c89de494a1f6c0cbaf34efe7a18f310c408cd23 (patch)
treef2207505ce6426d61b5799416d6a5740f541a12e
parent20c7fba60157067252af49da41b6f8929a5ae31a (diff)
downloadgitea-6c89de494a1f6c0cbaf34efe7a18f310c408cd23.tar.gz
gitea-6c89de494a1f6c0cbaf34efe7a18f310c408cd23.zip
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 <appleboy.tw@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--services/actions/notifier.go8
1 files changed, 8 insertions, 0 deletions
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)