Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to find all issues associated with a pull request?

I've been using Jira automation rules and GitHub to track the development process on my team, and we've been struggling with this issue. 

At the moment, we have a rule that works only when one issue is linked to one pull request (see below), writing the issue key on the title of the pull request. But my objective is to make a rule such that "When a pull request is merged, all the issues that are linked to that pull request transition to the status 'Ready For Build'", since sometimes multiple Jira issues/development issues are addressed on a single branch and then a single pull request is needed. 

image.png

From the question "Update multiple issues, that are not linked, using Jira Automation" the solution seems to be using a branch action and a JQL query (see the second figure below). But the thing is that I've not been able to find a way to detect all the issues associated with the merged pull request using JQL. Is there a way to do this?  

image.png

I've already checked that the pull request linked all my issues. In my case, the branch name was "WF-1009-WF-542-WF-635-model-plot" and the pull request title was something like "WF-1009 WF-542 WF-635: fixes of ..... #49", so the pull request #49 is correctly linked to the issues WF-1009, WF-542 and WF-635. Furthermore, every issue has the branch "WF-1009-WF-542-WF-635-model-plot" associated. 

1 answer

Hi @Ignacia Sanchez -- Welcome to the Atlassian Community!

I note in your screen grab that there is an error icon by the JQL branch.  Did you define the JQL for the branch?  If not, you could probably move the JQL from the condition immediately below it to the branch, and then delete the condition.

Or, move it above as shown in this article which is quite similar to your use case:

https://www.atlassian.com/devops/automation-tutorials/jira-automation-rule-on-pullrequest-merge

Kind regards,
Bill

Hello Bill! Yes, the error icon is because (for the purpose of taking the screenshot) I didn't add any JQL query haha. The main question is precisely how to make a query in that block that detects all the Jira issues associated with the merged pull request :) 

Sorry, I am not currently set up to test this rule with a build pipeline...My understanding was that trigger fires for each issue associated to the PR.  Is that not the case you are observing (i.e. it is firing only once, and not once per issue)?

Yes, my understanding was also that the trigger would fire for each issue associated to the PR, but the main thing is that is not happening, and that's why I searched for another way of doing it. In this case, I found that maybe I could do it with a JQL, but I dont know how to access to "all Jira issues associated with the merged pull request"

To complement the comprehension of the problem, here's some audit logs for the rule [F] that I thought It will work, but It didn't: The Jira Issue WF-636 had only one Pull request associated, so it worked properly. But the Jira Issues WF-1009, WF-542 and WF-635 (that where associated  all to one pull request), didn't worked. The rule developmen[pullrequests].open = 0 was true for all of them. 

PS: I added only the audit log for the Jira Issue WF-635, but for WF-1009 and WF-542 the image is the same. image.pngimage.png

Thanks for that info!  Based on your findings, you could branch with some adjustments to your rule.  Please try this to see how it helps:

  • trigger: pull request merged
  • branch: on JQL, changing myProject to your project
project = myProject 
AND issueType NOT IN (Story, Epic)
AND development[pullrequests].open = 0
    • action: transition the issue

I don't think this will work since my objective is only to transition the issues that are related to the pull request that's been merged. In fact, I wrote this JQL query on the advanced Issue navigator and more than 700 Jira issues where returned. 

What I really need is, on a branch, some JQL query like:  

project = myProject 
AND issueType NOT IN (Story, Epic)
AND development[pullrequests].open = 0 
AND pullrequest.Number = development[pullrequestNumber]

 And my main question is precisely if something like pullrequest.Number = development[pullrequestNumber] exists in Jira, or if there is some other way to access all the related issues of the merged pull request, so that every related issue with the pull request will be transitioned.

I haven't been able to learn that info after a few searches.  If you are on a paid license of Jira, please consider working with your site admin to submit this as a support ticket: https://support.atlassian.com/contact/#/

And once you hear from them, please consider posting what you learn to benefit the community.  Thanks!

Like Ignacia Sanchez likes this

I'll do that, and I'll post it If I know something. Thanks for the help! 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Partner Webinar Opportunities: January 2022

Hi everyone 👋, I really like the format of the webinar opportunities summary that @Jimmy Seddon posts monthly on the Welcome Centre group. It's a great place to go to check that you didn...

133 views 3 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you