Forums

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

Jira Automation Bitbucket branch exist condition - Transition trigger

owen heggen
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!
February 1, 2023

I am setting up Jira Automation to create new bitbucket branches when transitioning a ticket to InProgress.

However this will cause problems if a branch has already been created,
Additionally in some cases a developer may need to create a branch based on a different base branch, instead of Dev or Master.
For this a developer could create the branch in advanced before transitioning.

We need to determine if a bitbucket branch already exist for a ticket, before automatically creating a new one on transition.

I have looked at different conditions and cannot find a way of detecting if a code branch already exists.

The closest I can find is the branch smart values listed at the top of this document: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-development/

However that only works when using the Branch created trigger.

 

1 answer

1 accepted

0 votes
Answer accepted
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.
February 1, 2023

Hi @owen heggen -- Welcome to the Atlassian Community!

To do that I believe you can use a web request from the rule to call the BitBucket REST API and check if exists first.  Here is a how-to for calling a REST API from a rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

Kind regards,
Bill

owen heggen
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!
February 2, 2023

Cheers mate,
I'm yet to confirm this but it looks like it will work.
Just a matter of going through the bitbucket api and finding a suitable endpoint.
Then adding a following condition component to test the response from the web request action component.

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events