Skip to content

Commit

Permalink
minor improvements based on feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvarts committed Oct 29, 2024
1 parent b4f382d commit ad3eaa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/pkg/githubapi/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ func generatePromotionPrBody(ghPrClientDetails GhPrClientDetails, components str
// when we have multiple components, we are going to use the component that has the fewest skip paths
func getPromotionSkipPaths(promotion PromotionInstance) map[string]bool {
perComponentSkippedTargetPaths := promotion.Metadata.PerComponentSkippedTargetPaths
promotionSkipPaths := make(map[string]bool)
promotionSkipPaths := 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,
Expand All @@ -1161,7 +1161,6 @@ func getPromotionSkipPaths(promotion PromotionInstance) map[string]bool {
}
}


if len(perComponentSkippedTargetPaths) == 0 {
return promotionSkipPaths
}
Expand Down Expand Up @@ -1197,6 +1196,10 @@ func prBody(keys []int, newPrMetadata prMetadata, newPrBody string, promotionSki
sp := ""
tp := ""

// sort the paths so that we have a predictable order for tests
// and better readability for users
sort.Strings(newPrMetadata.PromotedPaths)

for i, k := range keys {
sp = newPrMetadata.PreviousPromotionMetadata[k].SourcePath
x := filterSkipPaths(newPrMetadata.PreviousPromotionMetadata[k].TargetPaths, promotionSkipPaths)
Expand Down Expand Up @@ -1226,8 +1229,6 @@ func filterSkipPaths(targetPaths []string, promotionSkipPaths map[string]bool) [
}
}

sort.Strings(paths)

return paths
}

Expand Down

0 comments on commit ad3eaa6

Please sign in to comment.