@@ -74,6 +74,9 @@ public async Task ProcessCatalogYamlAsync(string repoName, string catalogIdentif
74
74
// Perform this after CheckTags.
75
75
CheckType ( catalogYaml , parsedRepoName ) ;
76
76
77
+ // Cleanup tags, only after checking type
78
+ RemoveTagsThatDealWithType ( catalogYaml ) ;
79
+
77
80
string outputPath = filePath ?? fs . Path . Combine ( workspace , "catalog.yml" ) ;
78
81
string autoGeneratedOutputPath = autoGenFilePath ?? fs . Path . Combine ( workspace , ".githubtocatalog" , "auto-generated-catalog.yml" ) ;
79
82
@@ -245,7 +248,6 @@ private void CheckType(CatalogYaml catalogYaml, CleanTitle parsedRepoName)
245
248
// Always check the tags
246
249
if ( catalogYaml . Tags != null )
247
250
{
248
- List < string > filteredTopics = new List < string > ( ) ;
249
251
foreach ( var topic in catalogYaml . Tags )
250
252
{
251
253
var inferredType = InferArtifactContentType ( topic ) ;
@@ -254,13 +256,7 @@ private void CheckType(CatalogYaml catalogYaml, CleanTitle parsedRepoName)
254
256
catalogYaml . Type = inferredType ;
255
257
logger . LogDebug ( $ "Item Type could be inferred from repository topics { catalogYaml . Type } .") ;
256
258
}
257
- else
258
- {
259
- filteredTopics . Add ( topic ) ;
260
- }
261
259
}
262
-
263
- catalogYaml . Tags = filteredTopics ;
264
260
}
265
261
266
262
if ( String . IsNullOrWhiteSpace ( catalogYaml . Type ) )
@@ -270,6 +266,25 @@ private void CheckType(CatalogYaml catalogYaml, CleanTitle parsedRepoName)
270
266
}
271
267
}
272
268
269
+ private void RemoveTagsThatDealWithType ( CatalogYaml catalogYaml )
270
+ {
271
+ // Always check the tags
272
+ if ( catalogYaml . Tags != null )
273
+ {
274
+ List < string > filteredTopics = new List < string > ( ) ;
275
+ foreach ( var topic in catalogYaml . Tags )
276
+ {
277
+ var inferredType = InferArtifactContentType ( topic ) ;
278
+ if ( String . IsNullOrWhiteSpace ( inferredType ) )
279
+ {
280
+ filteredTopics . Add ( topic ) ;
281
+ }
282
+ }
283
+
284
+ catalogYaml . Tags = filteredTopics ;
285
+ }
286
+ }
287
+
273
288
/// <summary>
274
289
/// Creates a new catalog YAML object by reading the existing catalog.yml or manifest.yml file in the workspace.
275
290
/// If no file is found, it creates an empty catalog YAML object.
0 commit comments