Skip to content

Commit

Permalink
Implement MigrateRepository for the actions notifier (#28920)
Browse files Browse the repository at this point in the history
Fixes #28699

This PR implements the `MigrateRepository` method for `actionsNotifier`
to detect the schedules from the workflow files in the migrated
repository.
  • Loading branch information
Zettat123 authored Jan 25, 2024
1 parent c46316f commit 071b7b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions services/actions/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,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)
}

0 comments on commit 071b7b2

Please sign in to comment.