MCPcopy Create free account
hub / github.com/cloudbase/garm / GetGithubCredentials

Method GetGithubCredentials

runner/github_credentials.go:70–86  ·  view source on GitHub ↗
(ctx context.Context, id uint)

Source from the content-addressed store, hash-verified

68}
69
70func (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
88func (r *Runner) DeleteGithubCredentials(ctx context.Context, id uint) error {
89 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 3

IsAdminFunction · 0.92
GetGithubCredentialsFunction · 0.92
GetGithubCredentialsMethod · 0.65

Tested by

no test coverage detected