pull-request-notifier-for-bitbucket
pull-request-notifier-for-bitbucket copied to clipboard
Using filterString and filterRegexp
Hi,
I'd like to implement a notification which is only started, when the ${PULL_REQUEST_TO_BRANCH} is a specific branch of my repository. E.g. to send notifications of all PRs to the master branch for example.
I guess this is fairly simple, but I can't get my head around the filterString and filterRegexp fields from the docs.
Please help, many thanks in advance. Regards, Andras
Let the filter string be ${PULL_REQUEST_TO_BRANCH} and the filter regexp be master.
Awesome, thanks for the super-fast answer!
Perhaps you need regexp to be ^master$... there is a test case here: https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/blob/master/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java#L378
Hi, I have a similar question related to filter and regexp. I would like to have notification which is triggered when ${PULL_REQUEST_TO_BRANCH} = develop or master, and additionally, there should be the possibility to trigger the notification by pressing the button.
I suppose it should be something like that:
Filter string: ${PULL_REQUEST_TO_BRANCH}${BUTTON_TRIGGER_TITLE} Filter regexp: ^(develop|master)$|
I tried different ways, but couldn't combine those two conditions.
Could you please help with that?
Any button or a specific one?
Filter string: ${PULL_REQUEST_TO_BRANCH}_${BUTTON_TRIGGER_TITLE}_
Filter regexp: ^(develop|master)_.+_$ or ^(develop|master)(?!__$)
If it is a specific button, the filter regexp can be perhaps ^(develop|master)_That button name_$
Thanks for quick answer. I would like to have the specific button for notification. Button name: build-pr
After setting it:
Filter string: ${PULL_REQUEST_TO_BRANCH}${BUTTON_TRIGGER_TITLE} Filter regexp: ^(develop|master)build-pr$
the button has appeared, but the build wasn't triggered automatically when I created PR.
Ok. With filter string like ${PULL_REQUEST_TO_BRANCH}_${BUTTON_TRIGGER_TITLE}_ this should work ^(develop|master)(_build-pr_|__)$
It works now. Thanks a lot! The button has appeared in the pr context menu, but I see some strange empty lines there:
Do you know the reason?
No not sure why that happens. You only have one button configured right?
Yes, only one, at least for this particular repository.
Hi,
I have similar issue, I would like to trigger Jenkins when ${PULL_REQUEST_REVIEWERS_UNAPPROVED_COUNT} = 0, and ${PULL_REQUEST_TO_BRANCH} = master or release/*
how to set the filter?
This should work:
Filter: ${PULL_REQUEST_REVIEWERS_UNAPPROVED_COUNT} ${PULL_REQUEST_TO_BRANCH}
Regexp: 0 (master|release/.*)
https://jex.im/regulex/#!flags=&re=0%20(master%7Crelease%2F.*)
Hi, Thanks for the quick reply. I was faced with a new problem.How to fill Regexp with variables?
The regexp field does not support variables. Why do you need that?
Hey @tomasbjerre , I see this conversation tailed off, but I am looking to use variables in the regexp field because I'm trying to only send a notification when the person clicking the button is not the author of the pull request itself.
Is there another way of achieving that functionality without using the regexp field?
Sounds like a valid use case.
Hi,
I would like to trigger Jenkins when ${PULL_REQUEST_TO_BRANCH} = feature/ANZIDTPM-QA
how to set the filter?