ListRunners returns a list of runners of specified owner/repository name.
(ctx context.Context, enterprise, org, repo string)
| 224 | |
| 225 | // ListRunners returns a list of runners of specified owner/repository name. |
| 226 | func (c *Client) ListRunners(ctx context.Context, enterprise, org, repo string) ([]*github.Runner, error) { |
| 227 | enterprise, owner, repo, err := getEnterpriseOrganizationAndRepo(enterprise, org, repo) |
| 228 | |
| 229 | if err != nil { |
| 230 | return nil, err |
| 231 | } |
| 232 | |
| 233 | var runners []*github.Runner |
| 234 | |
| 235 | opts := github.ListOptions{PerPage: 100} |
| 236 | for { |
| 237 | list, res, err := c.listRunners(ctx, enterprise, owner, repo, &opts) |
| 238 | |
| 239 | if err != nil { |
| 240 | return runners, fmt.Errorf("failed to list runners: %w", err) |
| 241 | } |
| 242 | |
| 243 | runners = append(runners, list.Runners...) |
| 244 | if res.NextPage == 0 { |
| 245 | break |
| 246 | } |
| 247 | opts.Page = res.NextPage |
| 248 | } |
| 249 | |
| 250 | return runners, nil |
| 251 | } |
| 252 | |
| 253 | // ListOrganizationRunnerGroupsForRepository returns all the runner groups defined in the organization and |
| 254 | // inherited to the organization from an enterprise. |