From 55c53080d146913b29f2f45f05b6035e37338824 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Thu, 25 Jan 2024 20:27:11 +0800 Subject: [PATCH] Implement `MigrateRepository` for the actions notifier (#28920) (#28923) Backport #28920 by @Zettat123 Fixes #28699 This PR implements the `MigrateRepository` method for `actionsNotifier` to detect the schedules from the workflow files in the migrated repository. Co-authored-by: Zettat123 --- services/actions/notifier.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/actions/notifier.go b/services/actions/notifier.go index 6dc44143b6..1b9beb7d03 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -566,3 +566,15 @@ func (n *actionsNotifier) DeleteWikiPage(ctx context.Context, doer *user_model.U Page: page, }).Notify(ctx) } + +// MigrateRepository is used to detect workflows after a repository has been migrated +func (n *actionsNotifier) MigrateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) { + ctx = withMethod(ctx, "MigrateRepository") + + newNotifyInput(repo, doer, webhook_module.HookEventRepository).WithPayload(&api.RepositoryPayload{ + Action: api.HookRepoCreated, + Repository: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm_model.AccessModeOwner}), + Organization: convert.ToUser(ctx, u, nil), + Sender: convert.ToUser(ctx, doer, nil), + }).Notify(ctx) +}