(ctx context.Context, param params.CreateGithubCredentialsParams)
| 51 | } |
| 52 | |
| 53 | func (r *Runner) CreateGithubCredentials(ctx context.Context, param params.CreateGithubCredentialsParams) (params.ForgeCredentials, error) { |
| 54 | if !auth.IsAdmin(ctx) { |
| 55 | return params.ForgeCredentials{}, runnerErrors.ErrUnauthorized |
| 56 | } |
| 57 | |
| 58 | if err := param.Validate(); err != nil { |
| 59 | return params.ForgeCredentials{}, fmt.Errorf("failed to validate github credentials params: %w", err) |
| 60 | } |
| 61 | |
| 62 | creds, err := r.store.CreateGithubCredentials(ctx, param) |
| 63 | if err != nil { |
| 64 | return params.ForgeCredentials{}, fmt.Errorf("failed to create github credentials: %w", err) |
| 65 | } |
| 66 | |
| 67 | return creds, nil |
| 68 | } |
| 69 | |
| 70 | func (r *Runner) GetGithubCredentials(ctx context.Context, id uint) (params.ForgeCredentials, error) { |
| 71 | if !auth.IsAdmin(ctx) { |
nothing calls this directly
no test coverage detected