Skip to content

Commit 1b008e8

Browse files
Zettat123silverwind
authored andcommitted
Implement MigrateRepository for the actions notifier (go-gitea#28920)
Fixes go-gitea#28699 This PR implements the `MigrateRepository` method for `actionsNotifier` to detect the schedules from the workflow files in the migrated repository.
1 parent cabbc94 commit 1b008e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

services/actions/notifier.go

+12
Original file line numberDiff line numberDiff line change
@@ -565,3 +565,15 @@ func (n *actionsNotifier) DeleteWikiPage(ctx context.Context, doer *user_model.U
565565
Page: page,
566566
}).Notify(ctx)
567567
}
568+
569+
// MigrateRepository is used to detect workflows after a repository has been migrated
570+
func (n *actionsNotifier) MigrateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) {
571+
ctx = withMethod(ctx, "MigrateRepository")
572+
573+
newNotifyInput(repo, doer, webhook_module.HookEventRepository).WithPayload(&api.RepositoryPayload{
574+
Action: api.HookRepoCreated,
575+
Repository: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm_model.AccessModeOwner}),
576+
Organization: convert.ToUser(ctx, u, nil),
577+
Sender: convert.ToUser(ctx, doer, nil),
578+
}).Notify(ctx)
579+
}

0 commit comments

Comments
 (0)