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

Method GetInstalls

pkg/github/org/org.go:119–154  ·  view source on GitHub ↗
(
	ctx context.Context)

Source from the content-addressed store, hash-verified

117}
118
119func (org *Organization) GetInstalls(
120 ctx context.Context) (map[types.InstallID]types.Install, error) {
121 if len(org.Installations) > 0 {
122 return org.Installations, nil
123 }
124
125 log.Logger.Debugf(
126 "Fetching app installs for %s",
127 *org.info.Login,
128 )
129
130 opt := &github.ListOptions{PerPage: org.paginationSize}
131 installs, err := utils.GetPaginatedResult(
132 ctx,
133 org.backoff,
134 opt,
135 func(opts *github.ListOptions) (*github.OrganizationInstallations, *github.Response, error) {
136 return org.client.Organizations.ListInstallations(
137 ctx,
138 *org.info.Login,
139 opt,
140 )
141 },
142 utils.InstallsAggregator,
143 )
144 if err != nil {
145 log.Logger.Error(err)
146 }
147
148 installMap := make(map[types.InstallID]types.Install, len(installs))
149 for _, i := range installs {
150 installMap[types.InstallID(*i.ID)] = i
151 }
152 org.Installations = installMap
153 return installMap, err
154}
155
156func (org *Organization) GetActionRunners(
157 ctx context.Context) (map[types.RunnerID]types.Runner, error) {

Callers 1

AuditMethod · 0.95

Calls 1

GetPaginatedResultFunction · 0.92

Tested by

no test coverage detected