Skip to content

Commit

Permalink
Extra validation check for manifest tags (#11) (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Arne Maes <arne.maes@skyline.be>
  • Loading branch information
janstaelensskyline and ArneMaes0 authored Dec 2, 2024
1 parent 499b218 commit cb7f811
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,19 @@ private async Task CheckTags(CatalogYaml catalogYaml)
catalogYaml.Tags = new List<string>();
}

if(catalogYaml.Tags.Count >= 5)
{
logger.LogDebug("Catalog YAML has the max amount of tags already. Skipping the adding GitHub topics step.");
return;
}

var topics = await service.GetRepositoryTopicsAsync();
if (topics is { Count: > 0 })
{
catalogYaml.Tags.AddRange(topics);

// Remove duplicates
catalogYaml.Tags = catalogYaml.Tags.Distinct().ToList();
catalogYaml.Tags = catalogYaml.Tags.Distinct().Take(5).ToList();
logger.LogDebug("Distinct GitHub Topics found and applied.");
}
}
Expand Down

0 comments on commit cb7f811

Please sign in to comment.