@@ -11,31 +11,43 @@ type targetMapping struct {
1111 target string
1212}
1313
14+ // goTriggerPatterns lists patterns that trigger all Go-dependent targets.
15+ var goTriggerPatterns = []string {
16+ "go.mod" ,
17+ "go.sum" ,
18+ }
19+
1420var fileTargetMappings = []targetMapping {
1521 {
16- prefixes : []string {
22+ prefixes : slices .Concat (goTriggerPatterns , []string {
23+ // Specify files that match targets below and should still trigger the "test" target.
24+ }),
25+ target : "test" ,
26+ },
27+ {
28+ prefixes : slices .Concat (goTriggerPatterns , []string {
1729 "experimental/aitools/" ,
18- },
30+ }) ,
1931 target : "test-exp-aitools" ,
2032 },
2133 {
22- prefixes : []string {
34+ prefixes : slices . Concat ( goTriggerPatterns , []string {
2335 "experimental/apps-mcp/" ,
24- },
36+ }) ,
2537 target : "test-exp-apps-mcp" ,
2638 },
2739 {
28- prefixes : []string {
40+ prefixes : slices . Concat ( goTriggerPatterns , []string {
2941 "experimental/ssh/" ,
3042 "acceptance/ssh/" ,
31- },
43+ }) ,
3244 target : "test-exp-ssh" ,
3345 },
3446 {
35- prefixes : []string {
47+ prefixes : slices . Concat ( goTriggerPatterns , []string {
3648 "cmd/pipelines/" ,
3749 "acceptance/pipelines/" ,
38- },
50+ }) ,
3951 target : "test-pipelines" ,
4052 },
4153}
@@ -46,6 +58,7 @@ func GetTargets(files []string) []string {
4658 unmatchedFiles := []string {}
4759
4860 for _ , file := range files {
61+ // Check all mappings for this file (a file can match multiple targets).
4962 matched := false
5063 for _ , mapping := range fileTargetMappings {
5164 for _ , prefix := range mapping .prefixes {
@@ -55,9 +68,6 @@ func GetTargets(files []string) []string {
5568 break
5669 }
5770 }
58- if matched {
59- break
60- }
6171 }
6272 if ! matched {
6373 unmatchedFiles = append (unmatchedFiles , file )
0 commit comments