diff --git a/rule_runner_label.go b/rule_runner_label.go index 69758794f..b54df0422 100644 --- a/rule_runner_label.go +++ b/rule_runner_label.go @@ -206,12 +206,12 @@ func (rule *RuleRunnerLabel) verifyRunnerLabel(label *String) runnerOSCompat { known := rule.getKnownLabels() for _, k := range known { - matched, err := filepath.Match(k, l) - if matched { + m, err := filepath.Match(k, l) + if err != nil { + rule.Errorf(label.Pos, "label pattern %q is an invalid glob. kindly check list of labels in actionlint.yaml config file: %v", k, err) return compatInvalid } - if err != nil { - rule.Errorf(label.Pos, "label pattern %q is an invalid glob, kindly check list of labels in actionlint.yaml config file: %v", k, err) + if m { return compatInvalid } } diff --git a/rule_runner_label_test.go b/rule_runner_label_test.go index 11f676fa2..44d944bc7 100644 --- a/rule_runner_label_test.go +++ b/rule_runner_label_test.go @@ -72,7 +72,7 @@ func TestRuleRunnerLabelCheckLabels(t *testing.T) { what: "user-defined labels with invalid glob pattern", labels: []string{"self-hosted", "INSTANCE_TYPE=m6a.large"}, known: []string{"INSTANCE_TYPE=["}, - errs: []string{`label pattern "INSTANCE_TYPE=[" is an invalid glob, kindly check list of labels in actionlint.yaml config file: syntax error in pattern`}, + errs: []string{`label pattern "INSTANCE_TYPE=[" is an invalid glob. kindly check list of labels in actionlint.yaml config file: syntax error in pattern`}, }, { what: "matrix",