@@ -70,7 +70,7 @@ public async Task ProcessCatalogYamlAsync(string repoName, string catalogIdentif
70
70
71
71
CleanTitle parsedRepoName = CheckTitle ( repoName , catalogYaml ) ;
72
72
73
- // Perform this after CheckTags
73
+ // Perform this after CheckTags.
74
74
CheckType ( catalogYaml , parsedRepoName ) ;
75
75
76
76
string outputPath = filePath ?? fs . Path . Combine ( workspace , "catalog.yml" ) ;
@@ -185,6 +185,8 @@ private async Task CheckTags(CatalogYaml catalogYaml)
185
185
if ( topics is { Count : > 0 } )
186
186
{
187
187
catalogYaml . Tags . AddRange ( topics ) ;
188
+
189
+ // Remove duplicates
188
190
catalogYaml . Tags = catalogYaml . Tags . Distinct ( ) . ToList ( ) ;
189
191
logger . LogDebug ( "Distinct GitHub Topics found and applied." ) ;
190
192
}
@@ -231,15 +233,16 @@ private void CheckType(CatalogYaml catalogYaml, CleanTitle parsedRepoName)
231
233
logger . LogDebug ( $ "Item Type could be inferred from repository name { catalogYaml . Type } .") ;
232
234
}
233
235
234
- // If we still don't have a type, check topics for matching ArtifactContentType
235
- if ( String . IsNullOrWhiteSpace ( catalogYaml . Type ) && catalogYaml . Tags != null )
236
+ // Always check the tags
237
+ if ( catalogYaml . Tags != null )
236
238
{
237
239
foreach ( var topic in catalogYaml . Tags )
238
240
{
239
241
var inferredType = InferArtifactContentType ( topic ) ;
240
242
if ( ! String . IsNullOrWhiteSpace ( inferredType ) )
241
243
{
242
244
catalogYaml . Type = inferredType ;
245
+ catalogYaml . Tags . Remove ( topic ) ;
243
246
logger . LogDebug ( $ "Item Type could be inferred from repository topics { catalogYaml . Type } .") ;
244
247
break ;
245
248
}
0 commit comments