(ctx context.Context, repoID string, param params.InstallWebhookParams)
| 430 | } |
| 431 | |
| 432 | func (r *Runner) InstallRepoWebhook(ctx context.Context, repoID string, param params.InstallWebhookParams) (params.HookInfo, error) { |
| 433 | if !auth.IsAdmin(ctx) { |
| 434 | return params.HookInfo{}, runnerErrors.ErrUnauthorized |
| 435 | } |
| 436 | |
| 437 | repo, err := r.store.GetRepositoryByID(ctx, repoID) |
| 438 | if err != nil { |
| 439 | return params.HookInfo{}, fmt.Errorf("error fetching repo: %w", err) |
| 440 | } |
| 441 | |
| 442 | poolManager, err := r.poolManagerCtrl.GetRepoPoolManager(repo) |
| 443 | if err != nil { |
| 444 | return params.HookInfo{}, fmt.Errorf("error fetching pool manager for repo: %w", err) |
| 445 | } |
| 446 | |
| 447 | info, err := poolManager.InstallWebhook(ctx, param) |
| 448 | if err != nil { |
| 449 | return params.HookInfo{}, fmt.Errorf("error installing webhook: %w", err) |
| 450 | } |
| 451 | return info, nil |
| 452 | } |
| 453 | |
| 454 | func (r *Runner) UninstallRepoWebhook(ctx context.Context, repoID string) error { |
| 455 | if !auth.IsAdmin(ctx) { |
nothing calls this directly
no test coverage detected