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 can I create a JIRA workflow conditional that looks to see if a Pull Request Was Made

I'm trying to prevent a workflow transition if a pull request was not made for an particular linked ticket.

 

Example:

  • ABC-1234 ticket was created
  • A branch was made that contains ABC-1234 so JIRA links the ticket using the configuration in DVCS Accounts.
  • The Ticket goes through a workflow example: (To Do, In Progress, Code Review, QA, Done).
  • And From "In progress" to "Code Review" transition, I want to detect if a Pull Request was made on the linked ticket before allowing the transition.

    I see a workflow conditions an option for Value, in which I can select if Development (Dev Summary Custom Field) = a string. (screenshot below)
    Screen Shot 2017-12-07 at 2.27.11 PM.pngI tried the above, but the results are the ticket doesn't show the transition option if the above is valid.

    Here is the dev panel screenshot:

    Screen Shot 2017-12-07 at 2.29.47 PM.png

 

I can't find any help regarding this online, am I using the wrong string value in the conditional perhaps?

 

Thanks

-Lar

1 answer

We had similar task but need to check if is there any commit related to the issue.

We can query issues using "development[commits].all > 0" but can't check this in workflow "Conditions".

The solution is as follows:

  • Create custom field 'Has commit' of type 'Number'
  • Add loop transition "Code committed" to the status you need to transfer issue from. For us it is "In progress" status and "In progress"->"In progress" transition. 
    • Add trigger: "Automatically transitions the issue when a related commit is made in a connected repository"
    • Add condition "Hide From User Condition"
    • Add Post Function: "Update Issue Custom Field" to update 'Has commit' with 1

Now we can check if issue has commits in workflow conditions by checking "Compare Number Custom Field Condition" against "Has commit" custom field.

As for "Start Review" transition "In progress" -> "Code Review" we decided to not allow it manually.

It is configured to run only by trigger "Pull request created" or by Project Admin ('User Is In Project Role' condition) to deal with old issues with already created pull requests.

Finally developer just need to create a pull request and the issue transitioned automatically to "Code Review" status.

Thank you so much for this!!! This helped me solve a problem.

Suggest an answer

Log in or Sign up to answer
TAGS

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