MCPcopy Create free account
hub / github.com/crashappsec/github-analyzer / GetWebhooks

Method GetWebhooks

pkg/github/repo/repo.go:45–72  ·  view source on GitHub ↗
(
	ctx context.Context)

Source from the content-addressed store, hash-verified

43}
44
45func (repo *Repository) GetWebhooks(
46 ctx context.Context) (map[types.WebhookID]types.Webhook, error) {
47 if len(repo.Webhooks) > 0 {
48 return repo.Webhooks, nil
49 }
50
51 opt := &github.ListOptions{PerPage: repo.paginationSize}
52 hooks, err := utils.GetPaginatedResult(
53 ctx,
54 repo.backoff,
55 opt,
56 func(opts *github.ListOptions) ([]*github.Hook, *github.Response, error) {
57 return repo.client.Repositories.ListHooks(ctx,
58 *repo.info.Organization.Login,
59 *repo.info.Name,
60 opt,
61 )
62 },
63 utils.WebhooksAggregator,
64 )
65
66 hookMap := make(map[types.WebhookID]types.Webhook, len(hooks))
67 for _, h := range hooks {
68 hookMap[types.WebhookID(*h.ID)] = h
69 }
70 repo.Webhooks = hookMap
71 return hookMap, err
72}
73
74func (repo *Repository) GetWorkflows(
75 ctx context.Context) (map[types.WorkflowID]types.Workflow, error) {

Callers

nothing calls this directly

Calls 1

GetPaginatedResultFunction · 0.92

Tested by

no test coverage detected