** // create github label using api v4 func (ge *githubExporter) createGithubLabelV4(gc *githubv4.Client, label, labelColor string) (string, error) { m := createLabelMutation{} input := createLabelInput{ RepositoryID: ge.repositoryID, Name: githubv4.String(label), Color: githu
(ctx context.Context, gc *rateLimitHandlerClient, repositoryID string, label common.Label)
| 596 | */ |
| 597 | |
| 598 | func (ge *githubExporter) getOrCreateGithubLabelID(ctx context.Context, gc *rateLimitHandlerClient, repositoryID string, label common.Label) (string, error) { |
| 599 | // try to get label id from cache |
| 600 | labelID, err := ge.getLabelID(string(label)) |
| 601 | if err == nil { |
| 602 | return labelID, nil |
| 603 | } |
| 604 | |
| 605 | // RGBA to hex color |
| 606 | rgba := label.Color().RGBA() |
| 607 | hexColor := fmt.Sprintf("%.2x%.2x%.2x", rgba.R, rgba.G, rgba.B) |
| 608 | |
| 609 | ctx, cancel := context.WithTimeout(ctx, defaultTimeout) |
| 610 | defer cancel() |
| 611 | |
| 612 | labelID, err = ge.createGithubLabel(ctx, string(label), hexColor) |
| 613 | if err != nil { |
| 614 | return "", err |
| 615 | } |
| 616 | |
| 617 | return labelID, nil |
| 618 | } |
| 619 | |
| 620 | func (ge *githubExporter) getLabelsIDs(ctx context.Context, gc *rateLimitHandlerClient, repositoryID string, labels []common.Label) ([]githubv4.ID, error) { |
| 621 | ids := make([]githubv4.ID, 0, len(labels)) |
no test coverage detected