refactor: mv modules/notification/actions to services/actions

This commit is contained in:
Jason Song 2022-12-29 16:05:00 +08:00
parent c84094011e
commit ec020563ae
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
4 changed files with 7 additions and 6 deletions

View File

@ -12,7 +12,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification/action"
"code.gitea.io/gitea/modules/notification/actions"
"code.gitea.io/gitea/modules/notification/base"
"code.gitea.io/gitea/modules/notification/indexer"
"code.gitea.io/gitea/modules/notification/mail"
@ -41,9 +40,6 @@ func NewContext() {
RegisterNotifier(webhook.NewNotifier())
RegisterNotifier(action.NewNotifier())
RegisterNotifier(mirror.NewNotifier())
if setting.Actions.Enabled {
RegisterNotifier(actions.NewNotifier())
}
}
// NotifyNewWikiPage notifies creating new wiki pages to notifiers

View File

@ -16,13 +16,19 @@ import (
actions_module "code.gitea.io/gitea/modules/actions"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/queue"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
)
func Init() {
jobEmitterQueue = queue.CreateUniqueQueue("actions_ready_job", jobEmitterQueueHandle, new(jobUpdate))
go graceful.GetManager().RunWithShutdownFns(jobEmitterQueue.Run)
if setting.Actions.Enabled {
notification.RegisterNotifier(NewNotifier())
}
}
func DeleteResourceOfRepository(ctx context.Context, repo *repo_model.Repository) error {

View File

@ -23,7 +23,6 @@ import (
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
actions_service "code.gitea.io/gitea/services/actions"
"code.gitea.io/gitea/services/convert"
"github.com/nektos/act/pkg/jobparser"
@ -161,7 +160,7 @@ func notify(ctx context.Context, input *notifyInput) error {
log.Error("FindRunJobs: %v", err)
} else {
for _, job := range jobs {
if err := actions_service.CreateCommitStatus(ctx, job); err != nil {
if err := CreateCommitStatus(ctx, job); err != nil {
log.Error("CreateCommitStatus: %v", err)
}
}