Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the Jira ticket from a Github Pull Request

cheungw
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 4, 2025

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.

1 answer

1 vote
cheungw
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 4, 2025

I found a solution for it.

key = {{webhookData.pull_request.head.ref.split("/").last.split("-").first}}-{{webhookData.pull_request.head.ref.split("-").get(1)}}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events