( ctx context.Context)
| 154 | } |
| 155 | |
| 156 | func (org *Organization) GetActionRunners( |
| 157 | ctx context.Context) (map[types.RunnerID]types.Runner, error) { |
| 158 | if len(org.Runners) > 0 { |
| 159 | return org.Runners, nil |
| 160 | } |
| 161 | |
| 162 | log.Logger.Debugf( |
| 163 | "Fetching action runners for %s", |
| 164 | *org.info.Login, |
| 165 | ) |
| 166 | |
| 167 | opt := &github.ListOptions{PerPage: org.paginationSize} |
| 168 | runners, err := utils.GetPaginatedResult( |
| 169 | ctx, |
| 170 | org.backoff, |
| 171 | opt, |
| 172 | func(opts *github.ListOptions) (*github.Runners, *github.Response, error) { |
| 173 | return org.client.Actions.ListOrganizationRunners( |
| 174 | ctx, |
| 175 | *org.info.Login, |
| 176 | opt, |
| 177 | ) |
| 178 | }, |
| 179 | utils.RunnersAggregator, |
| 180 | ) |
| 181 | |
| 182 | runnerMap := make(map[types.RunnerID]types.Runner, len(runners)) |
| 183 | for _, r := range runners { |
| 184 | runnerMap[types.RunnerID(*r.ID)] = r |
| 185 | } |
| 186 | org.Runners = runnerMap |
| 187 | return runnerMap, err |
| 188 | } |
| 189 | |
| 190 | // GetUsers returns the users for a given org. Upon first call, |
| 191 | // it lazily updates the Organization with the user information |
no test coverage detected