How can I prevent an issue from transitioning if there are open pull requests?

Nickolas Schader May 29, 2018

I'd like to configure either a condition or a validator (or something similar) to prevent an issue from moving to a specific status if there are open pull requests associated with that Jira issue. We're usually pretty good at catching this, but on occasion there are multiple pull requests associated to a single Jira issue and on occasion the issue has been moved before all of the pull requests have been merged.

1 answer

1 vote
Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

@Nickolas Schaderit's all about permission,  if you set validation/condition even if the are multiple request  one who you  give permission/what you set can perform this transition, as  for move issue you  can also block who can move issue in a project in the permission schemes

 

best!

Nickolas Schader May 30, 2018

Thanks for the suggestion @Moses Thomas but I don't think it solves my issue. I want to prevent a developer from moving an issue when there is an open pull request. If we use permissions to limit who can perform the transition, they can still move it if there are open pull requests.

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 30, 2018

@Nickolas Schader

We have the View development tools permission 

this should do  the trick  see documentation.

https://confluence.atlassian.com/jirasoftwarecloud/viewing-the-development-information-for-an-issue-777002795.html

best!

Nickolas Schader June 4, 2018

Thanks @Moses Thomas, that allows us to view the Development information, but I don't see how to use that to prevent an issue from transitioning.

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 4, 2018

@Nickolas SchaderLets do  it this way previous suggestion  is not enough try  this

- You  have integrate your  /Bitbucket/Whatever  properly, 

- Add  a condition in this trasition > script condition >Allows the transition if this query matches a JQL query

-enter this JQL query : 

(status = Done OR resolution = done) AND development[pullrequests].all > 0 

this JQL should return  any issues that have  been resolved with a non-merged pull-request associated with the issue,  so  transition  can only  be performed if all  pull request  associated  with  this issue are done.

Hope this will do.

Nickolas Schader June 7, 2018

@Moses Thomas I think that would do it, but I don't see an option for 'script condition'. Is that part of the Script Runner add-on?

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 7, 2018

@Nickolas SchaderYes , unfortunately.

Anveshan Goel March 6, 2019

@Nickolas Schader Did you find any other way?

@Moses Thomas I have been working for the same Jira problem that is in discussion i.e. preventing an issue from transitioning if there are open pull requests.

I have Script Runner available but unable to find the correct way for doing it, can you assist?

Moses Thomas
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2019

@Anveshan Goel  This solution  Would work flow script runner plugin  for server, but script runner plugin  for  cloud  is limited  as there are differences,  I think  is why  @Nickolas Schader  can't  find  this option which i  have  mentioned. I am  afraid we don't have this  feature in  cloud.

Nickolas Schader March 6, 2019

Unfortunately I do not have Script Runner and have not been able to come up with a solution for this.

Levon_Shirakyan August 30, 2019

As always with Jira (atlassian). Valid issue and yet no viable solution. But hey, I'm sure Atlassian team is busy with full jira redesign yet again.

Sorry, could not resist... We have exactly the same problem where we need to prevent issues to be closed if an associated Pull Request is still open, and we are using Jira cloud.

Like # people like this
Tudor Achim May 18, 2021

FYI -- automation works for this. You can have a rule that automatically reverts the state of the ticket if there are open PRs.

Like Sakthiya Giri likes this
Magdalena Zhisheva
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.
January 17, 2022

Hi @Tudor Achim , 

Can you share how you achieved this with auto rule?

Gilad Sharaby March 29, 2022

@Magdalena Zhisheva not the exact same scenario which you're looking for, but I created the following rule which reopens tickets with no associated PRs and resolution done. 
Not sure it's the best way, but it's working.. 
image.png

Magdalena Zhisheva
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.
April 3, 2022

Hi @Gilad Sharaby , 

Thank you!

I were able to build the following rule and seems to working for now for two teams in our instance:

Screenshot 2022-04-03 at 15.23.10.png

Hope it will help someone :) 

Like # people like this
Michael Trieu December 29, 2022

Works for me! Thanks!

girish_nagappa January 30, 2023

Hi @Michael Trieu 

Can you help with the condition you have used to achieve this purpose?

Regards,

Girish

Michael Trieu January 30, 2023

Hi @girish_nagappa 

I used the same one as posted above

development[pullrequests].open != 0

Screen Shot 2023-01-30 at 7.21.05 AM.png

girish_nagappa January 31, 2023

Thanks for the update !!

Let me try and get back,

Regards,

Girish. N

Suggest an answer

Log in or Sign up to answer