jira automation get pull requests count

alex.tarasov March 20, 2023

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
Nick de Palézieux March 27, 2023

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

alex.tarasov March 29, 2023

thank you! Exactly what I need 

0 votes
alex.tarasov March 20, 2023

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
}
}

```

Dave Furlani March 29, 2023

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