diff --git a/services/actions/matrix.go b/services/actions/matrix.go index cc2fe3f9f6..8d332234b2 100644 --- a/services/actions/matrix.go +++ b/services/actions/matrix.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "maps" + "slices" "sort" "strings" @@ -165,12 +166,7 @@ func yamlNodeContainsNeedsOutputsExpr(node *yaml.Node) bool { if node.Kind == yaml.ScalarNode { return containsNeedsOutputsExpr(node.Value) } - for _, child := range node.Content { - if yamlNodeContainsNeedsOutputsExpr(child) { - return true - } - } - return false + return slices.ContainsFunc(node.Content, yamlNodeContainsNeedsOutputsExpr) } // containsNeedsOutputsExpr returns true when s contains a GitHub Actions diff --git a/services/actions/matrix_test.go b/services/actions/matrix_test.go index 1eb48a331d..4dbe75f842 100644 --- a/services/actions/matrix_test.go +++ b/services/actions/matrix_test.go @@ -60,7 +60,7 @@ matrix: want: false, }, { - name: "empty strategy", + name: "empty strategy", strategy: "", want: false, },