Transition Jira Issue when Bitbucket PR is approved

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

There are built-in triggers in Jira automation to capture events when PR is merged/created/declined. However, there is no built-in trigger to capture Pull request Approved yet (FR: JRACLOUD-81389 - Getting issue details... STATUS ). To achieve the same we can use a combination of Bitbucket outgoing webhook and Jira Automation for JIRA.

Environment

  • Jira Cloud
  • Bitbucket

Solution

Only pre-requisite of this solution is, the PR title should always have Issue key so that we extract that data using automation.

Jira Automation configuration :

  • Here is a screenshot of the automation that we need:
  • Explanation:
    • Trigger : Incoming webhook 
    • Log action : To verify what is the result we receive when event is received from webhook and processed by regex 

      {{webhookData.pullrequest.title.match("(\b[A-Z]+-\d+\b)")}} 
    • Branch Rule of the type JQL and in JQL add : 

      key = {{webhookData.pullrequest.title.match("(\b[A-Z]+-\d+\b)")}} 
    • Transition to desired Status

Bitbucket Configuration : 

  • Go to Bitbucket Repository > Repository Settings > Webhook
  • Create a Webhook and paste the link from "Incoming webhook" in Jira automation.
  • In webhook Trigger choose PR - Approved.

Whenever the PR is approved in Bitbucket, a webhook response is sent out and captured by automation. Automation then will extract issue from PR Title and transition respective issue.




Last modified on Oct 1, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.