Fix wildcard in middle of actionsglob/scaleUpTrigger.githubEvent.checkRun.names not working (#395)
actionsglob patterns like `foo-*-bar` was not correctly working. Tests and the implementation was enhanced to correctly support it.
This commit is contained in:
parent
264cf494e3
commit
9b871567b1
|
|
@ -65,7 +65,7 @@ func Match(pat string, s string) bool {
|
||||||
|
|
||||||
s = subs[1]
|
s = subs[1]
|
||||||
|
|
||||||
wildcardInHead = false
|
wildcardInHead = wildcardInTail
|
||||||
}
|
}
|
||||||
|
|
||||||
r := s == ""
|
r := s == ""
|
||||||
|
|
|
||||||
|
|
@ -195,4 +195,20 @@ func TestMatch(t *testing.T) {
|
||||||
Want: false,
|
Want: false,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("actions-*-metrics == actions-workflow-metrics", func(t *testing.T) {
|
||||||
|
run(t, testcase{
|
||||||
|
Pattern: "actions-*-metrics",
|
||||||
|
Target: "actions-workflow-metrics",
|
||||||
|
Want: true,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("!actions-*-metrics == actions-workflow-metrics", func(t *testing.T) {
|
||||||
|
run(t, testcase{
|
||||||
|
Pattern: "!actions-*-metrics",
|
||||||
|
Target: "actions-workflow-metrics",
|
||||||
|
Want: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue