Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,395
Community Members
 
Community Events
184
Community Groups

jira automation get pull requests count

Hello guys and gals. 

I have the following automation

When Pull Request is merged -> move the task to the DONE state.

 

image.png

 

Sometimes there are could be more than 1 dedicated pull request and I want to check

  • if there are no other open PRs -> then move the issue to the particular state. 
  • if not, i.e. there is still an open PR/s -> then do not move the issue to another state

 

I can't find a way to get the number of open pull requests. Is there a way to do that?

Thanks!

2 answers

1 accepted

1 vote
Answer accepted

I have a very similar automation rule: If an issue is moved to `Done`, but there are open PRs or no PRs at all (I want there to be PRs for the issue, and I want them all to be merged), move it back. This is the relevant check, something like this should work for you as well:

Screenshot 2023-03-27 at 23.54.45.png

thank you! Exactly what I need 

I tried to use the following smart value:

` {{issue.development}}`

 

that gave me the following answer. In theory, I need the `state=OPEN` but I have no idea how can I parse it or get the parameter value

```json

{pullrequest={dataType=pullrequest, state=OPEN, stateCount=2
}, build={count=2, dataType=build, failedBuildCount=0, successfulBuildCount=2, unknownBuildCount=0
}, json={
"cachedValue": {
"errors": [],
"summary": {
"pullrequest": {
"overall": {
"count": 2,
"lastUpdated": "2023-02-27T08:40:31.000+0000",
"stateCount": 2,
"state": "OPEN",
"dataType": "pullrequest",
"open": true
},
"byInstanceType": {
"GitHub": {
"count": 2,
"name": "GitHub"
}
}
},
"build": {
"overall": {
"count": 2,
"lastUpdated": null,
"failedBuildCount": 0,
"successfulBuildCount": 2,
"unknownBuildCount": 0,
"dataType": "build"
},
"byInstanceType": {
"cloud-providers": {
"count": 2,
"name": "Other providers"
}
}
}
}
},
"isStale": false
}
}

```

You could perhaps use an Advanced Compare Condition step, and check if  

{{issue.development}}

Contains

state=OPEN

Suggest an answer

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

Atlassian Community Events