Add regex filter support
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
This makes any filter that starts and ends in forward slashes act as a regex filter instead of a simple substring filter. Currently doesn't support trailing flags unlike actual JS regexes, so modifiers should be used instead for that functionality: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier
This commit is contained in:
parent
4a50b1273d
commit
105154a42b
1 changed files with 4 additions and 0 deletions
|
@ -4,6 +4,10 @@ export const muteWordHits = (status, muteWords) => {
|
|||
const statusText = status.text.toLowerCase()
|
||||
const statusSummary = status.summary.toLowerCase()
|
||||
const hits = filter(muteWords, (muteWord) => {
|
||||
if (muteWord.startsWith('/') && muteWord.endsWith('/')) {
|
||||
const muteRegex = new RegExp(muteWord.slice(1, -1))
|
||||
return muteRegex.test(statusText) || muteRegex.test(statusSummary)
|
||||
}
|
||||
return statusText.includes(muteWord.toLowerCase()) || statusSummary.includes(muteWord.toLowerCase())
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue