mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 12:06:57 +00:00
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:
@@ -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,
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user