Forums

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

Can we Set JIRA Issue Field Value Equal to Bitbucket Repository Name

Darren Marshall September 3, 2020

We run a single project for all new feature work, defects, and improvements for our product. There are somewhere in the vicinity of 30 repositories that make up our product, which is likely to grow over the coming months.

We are looking for a way to automatically add a label, component, or otherwise set some other field value to match the repository (or repositories) name when a pull request has been merged.

I've had a look at the OOTB Jira Automation possibilities and not really seeing much there that would be able to get the repo name from our connected Bitbucket then set that value on an issue. It seems I can detect when a PR was merged, which is fantastic (I'll use this for other things) and gets me part of the way there.

Any help would be great.

TLDR; Trying to get repository name from bitbucket after pull request merged, to the set this as a value in a Jira issue.

1 answer

0 votes
Jira Guru
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.
September 12, 2020

Hi @Darren Marshall 

Using jira automation you can achieve what you are looking for. Please take a look into this link:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-development/

Darren Marshall September 16, 2020

Cool! I'll look into how to leverage these smart values, but seems to be a step in the right direction.

Any idea what would happen if a ticket had multiple pull requests across multiple repos? ie would I still be able to use, say, this smart value:

{{pullRequest.sourceBranch.repository}}

 Would I get an array of values plugged into the field I want, or just the first one found?

Darren Marshall September 23, 2020

I have tried the following rules in Automation, but have not had any luck in getting the label field to be set:

1.
WHEN: Pull request merged
THEN: Edit issue fields LABEL {{branch.repository}} (also tried {{pullRequest.sourceBranch.url}})


2.

WHEN: Issue transitioned from In Progress to Deployed to Dev
THEN: Edit issue fields LABEL {{branch.repository}} (also tried {{pullRequest.sourceBranch.url}})

I have set up email alerts to tell me if the rule fails, but I have received no alert and no Label fiel set. Without some sort of feedback on why this works, it just seems like this feature simply doesn't work. @Jira Guru is there somewhere I can poke around to find out why this rule seems to not have run? Or am I using smart values incorrectly, perhaps against a field that doesn't support it?

wwalser
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2020

@Darren Marshall You should be able to test an automation rule using a few different techniques. 

It's a bit to type out, so I've just shot a quick video for you: https://www.loom.com/share/2987c5e4879f481996b074126b49d19e

Darren Marshall October 5, 2020

Thanks Wes! Some good tips in there I'll put to use today and see if I can work out my situation

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