aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2023-04-18 01:49:47 +0800
committerGitHub <noreply@github.com>2023-04-17 13:49:47 -0400
commit5eb4c6386709259a9280c5aad6e0488f381144c5 (patch)
tree8c0b8f1200b6ee10c3d32ba8637daeec95d56fb6 /services
parent4014200021a1997283c779a815fe9e5febf1fda1 (diff)
downloadgitea-5eb4c6386709259a9280c5aad6e0488f381144c5.tar.gz
gitea-5eb4c6386709259a9280c5aad6e0488f381144c5.zip
Support triggering workflows by wiki related events (#24119)
This PR is to support triggering workflows by wiki related events like creating, editing or deleting wiki pages. In GitHub, this event is called [gollum](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#gollum)
Diffstat (limited to 'services')
-rw-r--r--services/actions/notifier.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/services/actions/notifier.go b/services/actions/notifier.go
index 6956c25cee..4ac77276ff 100644
--- a/services/actions/notifier.go
+++ b/services/actions/notifier.go
@@ -526,3 +526,38 @@ func (n *actionsNotifier) NotifyPullRequestChangeTargetBranch(ctx context.Contex
WithPullRequest(pr).
Notify(ctx)
}
+
+func (n *actionsNotifier) NotifyNewWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) {
+ ctx = withMethod(ctx, "NotifyNewWikiPage")
+
+ newNotifyInput(repo, doer, webhook_module.HookEventWiki).WithPayload(&api.WikiPayload{
+ Action: api.HookWikiCreated,
+ Repository: convert.ToRepo(ctx, repo, perm_model.AccessModeOwner),
+ Sender: convert.ToUser(ctx, doer, nil),
+ Page: page,
+ Comment: comment,
+ }).Notify(ctx)
+}
+
+func (n *actionsNotifier) NotifyEditWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page, comment string) {
+ ctx = withMethod(ctx, "NotifyEditWikiPage")
+
+ newNotifyInput(repo, doer, webhook_module.HookEventWiki).WithPayload(&api.WikiPayload{
+ Action: api.HookWikiEdited,
+ Repository: convert.ToRepo(ctx, repo, perm_model.AccessModeOwner),
+ Sender: convert.ToUser(ctx, doer, nil),
+ Page: page,
+ Comment: comment,
+ }).Notify(ctx)
+}
+
+func (n *actionsNotifier) NotifyDeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, page string) {
+ ctx = withMethod(ctx, "NotifyDeleteWikiPage")
+
+ newNotifyInput(repo, doer, webhook_module.HookEventWiki).WithPayload(&api.WikiPayload{
+ Action: api.HookWikiDeleted,
+ Repository: convert.ToRepo(ctx, repo, perm_model.AccessModeOwner),
+ Sender: convert.ToUser(ctx, doer, nil),
+ Page: page,
+ }).Notify(ctx)
+}