Transition Jira Issue when Bitbucket PR is approved
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
要約
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-81389Getting issue details... STATUS ). To achieve the same we can use a combination of Bitbucket outgoing webhook and Jira Automation for JIRA.
環境
- Jira Cloud
- Bitbucket
ソリューション
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:
- 説明:
- 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.