I have been running this JQL search on the incoming webhooks to get the Jira ticket
key = {{webhookData.pull_request.head.ref.substringAfter("/")}}
so this would get the Jira ticket ABC-1234 from the branch 'feature/ABC-1234'
but now I want to get the Jira ticket ABC-1234 from the branch 'feature/ABC-1234-develop'
I have tried the suggestions below but these don't work.
key = {{webhookData.pull_request.head.ref.match("[A-Z]+-[0-9]+")}}
key = {{webhookData.pull_request.head.ref.substringAfter("/").split("-").slice(0,2).join("-")}}
key = {{webhookData.pull_request.head.ref.substringAfter('/').match('[A-Z]+-[0-9]+')}}
Any ideas what the correct code should be?
Thanks in advance.
I found a solution for it.
key = {{webhookData.pull_request.head.ref.split("/").last.split("-").first}}-{{webhookData.pull_request.head.ref.split("-").get(1)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.