So I have a Jira automation that will progress a ticket from one state to another when a PR is merged. That is pretty straight forward and is mostly OOTB in Jira.
However, I want to add a constraint to this to only progress it when there are no open pull requests against the ticket. Our tickets can on occasion link to multiple repos which can have a pull request open against them. I appreciate this may not be the norm, or maybe it is.
I want to add an if condition to my automation rule that says, if there are no open PRs against the ticket, move it to the next state. Is this possible using a rule, smart values or JQL to achieve this?
Yes, this is doable in Jira Cloud, but I’d use JQL rather than PR smart values for the “no other open PRs” check.
{{pullRequest.state}} only tells you about the PR that triggered the rule. If one PR was merged but the issue still has another open PR in a different repo, that smart value alone will not catch it.
Jira supports development JQL fields, so you can add a JQL condition after the “Pull request merged” trigger.
Example:
issuekey = {{issue.key}} AND development[pullrequests].open = 0
If that condition passes, transition the issue.
If not, do nothing.
Hi @Gary Parker
My understanding is the pull request-related smart values are only available with the specific PR triggers, and only provide information for that specific PR in the trigger.
To check for other open PRs, one could use the Send Web Request action in a rule to call the REST API endpoints in your source control tool to check for that work item key.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.