How to find all issues associated with a pull request?

Ignacia October 21, 2021

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

0 votes
Bill Sheboy
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.
October 21, 2021

Hi @Ignacia -- 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

Ignacia October 21, 2021

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 :) 

Bill Sheboy
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.
October 21, 2021

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)?

Ignacia October 22, 2021

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

Bill Sheboy
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.
October 22, 2021

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
Ignacia October 25, 2021

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.

Bill Sheboy
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.
October 25, 2021

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 likes this
Ignacia October 26, 2021

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

Like Bill Sheboy likes this
robrecht-vanmelckebeke
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2022

Hi, I guess you didn't find a solution?

Nishant Shah
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 17, 2023

@Ignacia I am also looking for something like this. Did you manage to find a solution?

Like # people like this
Lucca
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2025

No solution yet?

Ignacia January 27, 2025

Sorry for the late follow-up on this issue—spoiler: we don't use Jira anymore.

In the end, we couldn't find a reliable way to address this and ultimately decided to migrate to GitHub Projects for greater flexibility. At that time, the integration between Jira and GitHub was quite basic, whereas GitHub Projects offered workflows specifically designed for development teams. Additionally, if a custom workflow is required, you can create one using GitHub Actions.

That said, this solution may not be suitable for all types of teams. We were able to make this switch because our workflow didn’t require close issue tracking with the client team.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events