(ctx context.Context, id uint)
| 68 | } |
| 69 | |
| 70 | func (r *Runner) GetGithubCredentials(ctx context.Context, id uint) (params.ForgeCredentials, error) { |
| 71 | if !auth.IsAdmin(ctx) { |
| 72 | return params.ForgeCredentials{}, runnerErrors.ErrUnauthorized |
| 73 | } |
| 74 | |
| 75 | creds, err := r.store.GetGithubCredentials(ctx, id, true) |
| 76 | if err != nil { |
| 77 | return params.ForgeCredentials{}, fmt.Errorf("failed to get github credentials: %w", err) |
| 78 | } |
| 79 | |
| 80 | cached, ok := cache.GetGithubCredentials((creds.ID)) |
| 81 | if ok { |
| 82 | creds.RateLimit = cached.RateLimit |
| 83 | } |
| 84 | |
| 85 | return creds, nil |
| 86 | } |
| 87 | |
| 88 | func (r *Runner) DeleteGithubCredentials(ctx context.Context, id uint) error { |
| 89 | if !auth.IsAdmin(ctx) { |
nothing calls this directly
no test coverage detected