@@ -66,36 +66,26 @@ func labelsMatch(prLabels, ignoreLabels, selectLabels []string) bool {
66
66
}
67
67
68
68
// If the pull request contains any of the ignore labels, it doesn't match
69
- if len (ignoreLabels ) > 0 && len (prLabels ) > 0 {
70
- for _ , l := range ignoreLabels {
71
- if i := slices .Index (prLabels , l ); i != - 1 {
72
- return false
73
- }
69
+ for _ , l := range ignoreLabels {
70
+ if slices .Contains (prLabels , l ) {
71
+ return false
74
72
}
75
73
}
76
74
77
- // If ignoreLabels are specified without selectLabels and the pull request has no labels, it matches
78
- if len (ignoreLabels ) > 0 && len (selectLabels ) == 0 && len (prLabels ) == 0 {
79
- return true
80
- }
81
-
82
75
// If selectLabels are specified but the pull request has no labels, it doesn't match
83
76
if len (selectLabels ) > 0 && len (prLabels ) == 0 {
84
77
return false
85
78
}
86
79
87
80
// If the pull request contains any of the select labels, it matches
88
- if len (selectLabels ) > 0 && len (prLabels ) > 0 {
89
- for _ , l := range selectLabels {
90
- if i := slices .Index (prLabels , l ); i != - 1 {
91
- return true
92
- }
81
+ for _ , l := range selectLabels {
82
+ if slices .Contains (prLabels , l ) {
83
+ return true
93
84
}
94
- // If none of the select labels are found, it doesn't match
95
- return false
96
85
}
97
86
98
- return true
87
+ // If none of the select labels are found, it doesn't match
88
+ return len (selectLabels ) == 0
99
89
}
100
90
101
91
// GraphQL response structure for PR status info
0 commit comments