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

Method PingEntityHook

util/github/client.go:170–196  ·  view source on GitHub ↗
(ctx context.Context, id int64)

Source from the content-addressed store, hash-verified

168}
169
170func (g *githubClient) PingEntityHook(ctx context.Context, id int64) (ret *github.Response, err error) {
171 metrics.GithubOperationCount.WithLabelValues(
172 "PingHook", // label: operation
173 g.entity.LabelScope(), // label: scope
174 ).Inc()
175 defer func() {
176 if err != nil {
177 metrics.GithubOperationFailedCount.WithLabelValues(
178 "PingHook", // label: operation
179 g.entity.LabelScope(), // label: scope
180 ).Inc()
181 }
182 }()
183 switch g.entity.EntityType {
184 case params.ForgeEntityTypeRepository:
185 ret, err = g.repo.PingHook(ctx, g.entity.Owner, g.entity.Name, id)
186 case params.ForgeEntityTypeOrganization:
187 ret, err = g.org.PingHook(ctx, g.entity.Owner, id)
188 default:
189 return nil, errors.New("invalid entity type")
190 }
191
192 if err == nil && ret != nil {
193 g.recordLimits(ret.Rate)
194 }
195 return ret, err
196}
197
198func (g *githubClient) ListEntityRunners(ctx context.Context, opts *github.ListRunnersOptions) (*github.Runners, *github.Response, error) {
199 var ret *github.Runners

Callers

nothing calls this directly

Calls 2

recordLimitsMethod · 0.95
LabelScopeMethod · 0.80

Tested by

no test coverage detected