How to get epic link from Bitbucket pull request webhook trigger in Jira Project Automation

Polaris
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!
November 11, 2024

Hello,

I have Jira and Bitbucket in the company I am working at. The purpose of this question is to automate task creation in Jira according to Bitbucket.

I created a rule in Jira Project Automation to listen webhook triggers from Bitbucket. The event is pull request : open. And webhook can be triggered with no errors. I have linked issue in Bitbucket pull request. And this issue has a link to an epic defined in our Jira project. I can automate creating new issues and assign these issues to reviewers added in pull request. 

Also I want to create epic link for these newly created issues. But I couldn't access linked issue in pull request. (I can parse from webhookData.pullrequest.fromRef.displayId but can't access this issue's fields). And I can't write scripts to achieve this as well sadly. (Because of company policy I don't have direct access to virtual machine that is hosting Jira)

How can I achieve this using Jira Project Automation? 

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2024

Hi @Polaris -- Welcome to the Atlassian Community!

For a question like this, it helps to post images of your complete rule, any relevant actions, and the audit log details showing the rule execution.  Those provide context for the community to offer better suggestions.

Without seeing your rule...

If you have the key / id of the Epic, your rule could use the Lookup Issues action to load the data from the issue. 

For Jira Data Center, this will only load a limited number of fields.  If you need other issue fields, the rule would need to branch to the issue with JQL or use the Send Web Request action to call the REST API endpoint for an issue search.  Seeing the specifics of your rule will help clarify what may help better.

Kind regards,
Bill

Polaris
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!
November 12, 2024

Hi @Bill Sheboy , Thank you so much!

Even without seeing the rule, your response is very helpful. Lookup Issues action is exactly what i am looking for. Unfortunately there is no action like that in my end. (It is because of we are using Jira Data Center not Jira Cloud)

I can get issue key from pull request with following smart value:

key = {{webhookData.pullrequest.fromRef.displayId.match("(\b[A-Z]+-\d+\b)")}} 

If I can access this issue, I will get the epic and it will be possible to link this epic to the newly created issues. 

 

For pictures sadly I can't provide anything for now. But the rule flow is like following:

1. Trigger Webhook from Bitbucket

2. Check reviewer count from 

{{webhookData.pullRequest.reviewers.size}}

3. Create issue for each reviewer for Code Review

Summary: {{webhookData.pullRequest.title}} - Code Review

Description: Click for Pull Request : {{webhookData.pullRequest.links.self.href}}

Assignee: {{webhookData.pullRequest.reviewers.get(0).user.name}}

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2024

Which version of Jira Data Center are you using?  I believe the Lookup Issues action was added in version 9.0

https://confluence.atlassian.com/automation/jira-data-center-automation-release-notes-1018767858.html#JiraDataCenterautomationreleasenotes-9.0.0-9.0.19.0.0-9.0.1

That is also when the Create Variable action was added, and that may help for extracting / saving the Epic's key.

 

Once you have that, it could be used to link the new issues.

Suggest an answer

Log in or Sign up to answer