Want to create rule so issue cannot be moved to done when PR is open

Jyothi November 4, 2024

HI,

Looking for automation rule, when Pull request is open, issue cannot be moved to done. Instead if tried to move, system should not allow to Done status unless PR is merged.

Thank you

2 answers

2 votes
Tobias H
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.
November 4, 2024

Hi @Jyothi and welcome to the community!

I wonder if there's a way to do it via Conditions set on the workflow, as that would block users from moving it all together if there's an active Pull Request.

However, I did find a way you could at least build an automation with it, so that it goes back to a status if it's moved with a PR open.

See this thread: https://community.atlassian.com/t5/Jira-questions/Re-Re-How-can-I-prevent-an-issue-from-transitioning-if/qaq-p/2254476/comment-id/565498#M565498

But in short, you can use the JQL development[pullrequests].open != 0 to look for pull requests that are open.

Best, Tobias

Jyothi November 4, 2024

Thank you @Tobias H ,

I am trying to use that, but when I test it , I am able to move the status to Done when PR is open. Not sure where I was doing wrong. Is there any way where I can disable the Done button when developer tries to move to Done from In-Progress when Pull request is Open ?

Thank you.

Tobias H
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.
November 4, 2024

Automations can't block transitions, they can only be used to trigger an additional transition back to the desired status.

So if you set up:

When Issue transition to Done
IF JQL development[pullrequests].open != 0
Then Transition issue to <Status of choice>

 

In order to actively stop the transition from happening, you will have to use conditions in the transition states of the Workflow: https://support.atlassian.com/jira-cloud-administration/docs/configure-advanced-issue-workflows/

However, I am not sure how you could map it to check for open Pull Requests through this method, but perhaps someone more versed in that will jump in and offer a solution

Jyothi November 4, 2024

I have used same but still I am able to change to Done from In-progress and its not transitioning back to In-progress state .

Jyothi November 4, 2024

Hi, Its working . As in, I am able to mark to Done from In-Progress. But after few mintutes when i refresh the page, its shown as In-progress. So transition is working but developer things he has closed :( . Need a way to let the develoepr know that the issue is made to In-progress. Is there any way to do it.Thank you.

0 votes
Doreen Undiri
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.
November 4, 2024

Hi @Jyothi 

Try using a workflow condition to prevent an issue from being moved to "Done" if there is an open pull request.  

Jira Settings > Issues > Workflows, locate the workflow for your project and enter edit mode. Find the transition that leads to the "Done" status, then click on the transition arrow to configure it. Under Conditions, add a Condition on Linked Development (available if your Jira instance is integrated with development tools). Set this condition to allow the transition to "Done" only if there are no open pull requests. 

I hope it helps


Dd 

Jyothi November 4, 2024

Thanks @Doreen Undiri  but i could not edit the work flow as its been used by many projects and not just for my project.:(

Doreen Undiri
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.
November 4, 2024

What type of permission do you have?

If you’re a Jira Administrator, you can create a new workflow that includes the conditions or validators you need. Copy the existing shared workflow and make the necessary modifications in the copy. Once you have your customized workflow, create a new workflow scheme that includes it, and then assign this scheme exclusively to your project. This way, you’ll have the restriction applied just to your project without affecting other projects using the original shared workflow.

If you’re a Project Administrator  you have limited options , you can use project-specific automation rules as a workaround. set an automation rule that triggers when an issue is moved to “Done.” The rule can check if there’s an open pull request, and if one exists, it can automatically revert the issue to the previous status and notify the user. While this won’t block the transition directly, it accomplishes a similar effect by undoing it when conditions aren’t met.

if this doesn’t fully meet your needs, you can request that a Jira Administrator create a custom workflow for your project with the necessary restriction in place.


Dd

Jyothi November 4, 2024

Will check the access I have and try the option.Thank you

Suggest an answer

Log in or Sign up to answer