(client *api.Client, host, owner string, repositoryNames []string)
| 286 | } |
| 287 | |
| 288 | func getRepoIds(client *api.Client, host, owner string, repositoryNames []string) ([]int64, error) { |
| 289 | if len(repositoryNames) == 0 { |
| 290 | return nil, nil |
| 291 | } |
| 292 | repos := make([]ghrepo.Interface, 0, len(repositoryNames)) |
| 293 | for _, repositoryName := range repositoryNames { |
| 294 | if repositoryName == "" { |
| 295 | continue |
| 296 | } |
| 297 | var repo ghrepo.Interface |
| 298 | if strings.Contains(repositoryName, "/") || owner == "" { |
| 299 | var err error |
| 300 | repo, err = ghrepo.FromFullNameWithHost(repositoryName, host) |
| 301 | if err != nil { |
| 302 | return nil, fmt.Errorf("invalid repository name") |
| 303 | } |
| 304 | } else { |
| 305 | repo = ghrepo.NewWithHost(owner, repositoryName, host) |
| 306 | } |
| 307 | repos = append(repos, repo) |
| 308 | } |
| 309 | if len(repos) == 0 { |
| 310 | return nil, fmt.Errorf("resetting repositories selected to zero is not supported") |
| 311 | } |
| 312 | repositoryIDs, err := api.GetRepoIDs(client, host, repos) |
| 313 | if err != nil { |
| 314 | return nil, fmt.Errorf("failed to look up IDs for repositories %v: %w", repositoryNames, err) |
| 315 | } |
| 316 | return repositoryIDs, nil |
| 317 | } |
no test coverage detected