From c891f07d949267a0e52e34275b9da2f016733136 Mon Sep 17 00:00:00 2001 From: Arthur Shvarts Date: Tue, 29 Oct 2024 11:33:41 -0400 Subject: [PATCH] handle case for a component with 0 skipPaths --- internal/pkg/githubapi/github.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/pkg/githubapi/github.go b/internal/pkg/githubapi/github.go index f771598c..0861466c 100644 --- a/internal/pkg/githubapi/github.go +++ b/internal/pkg/githubapi/github.go @@ -1150,6 +1150,17 @@ func generatePromotionPrBody(ghPrClientDetails GhPrClientDetails, components str func getPromotionSkipPaths(promotion PromotionInstance) map[string]bool { perComponentSkippedTargetPaths := promotion.Metadata.PerComponentSkippedTargetPaths promotionSkipPaths := make(map[string]bool) + + // if any promoted component is not in the perComponentSkippedTargetPaths + // then that means we have a component that is promoted to all paths, + // therefore, we return an empty promotionSkipPaths map to signify that + // there are no paths that are skipped for this promotion + for _, component := range promotion.Metadata.ComponentNames { + if _, ok := promotion.Metadata.PerComponentSkippedTargetPaths[component]; !ok { + return promotionSkipPaths + } + } + if perComponentSkippedTargetPaths == nil { return promotionSkipPaths }