Forums

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

Transition issues to "Code Review" only if the # of pull requests = # of branches

Tomer Horowitz July 7, 2023

I'm working on a Jira automation that moves issues to the 'Code Review' status. My problem is that a single Jira issue in my project can be associated with multiple reports and have numerous branches and pull requests (PRs).


I want the issue to transition to the 'Code Review' status only when all associated branches have an open pull request. I've attempted to set conditions based on the development fields in Jira Query Language (JQL), explicitly using development[branches].all and development[pullrequests].open. Still, Jira doesn't support a direct comparison between these two.

How can I set a condition to ensure all associated branches of a Jira issue have open PRs before it transitions to 'Code Review'? I'm looking for a solution that doesn't involve manual tracking.

Any guidance or workaround suggestions would be greatly appreciated!

1 answer

0 votes
Anthony Morais
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.
July 7, 2023

Hi @Tomerh2001 

Welcome to the Atlassian Community!!!

You can create two automations:

But first, create a custom field of type Select List (single choice) called ex: Pull
with Yes and No values

First Automation

Trigger: When pull request is created

Then: Edit issue (Pull field)

Rule1.png

Second Automation:

1) Trigger: When Field value changed (Pull)

2)If/Else
Choose condition Ex: Projects

3) Branch rule / related issues
For linked issues: All

4) Issue fields condition
Field: Pull
equals Yes

5) Transition issue:
Then: Code Review

Rule2.png

 

In the second automation, check the box "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule."

 

See the results:

results.png

I hope it helps!

Regards,

Anthony

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events