Looking for a little bit of help moving a jira ticket based on the status of its associated Git PR

Chris Carpenter August 9, 2022

Hey folks

We have been working towards move our dev tickets through our jira workflow based on the status of their pull requests and commits and such in GitHub, using Automation For Jira. We can do most of what we want with the Automation For Jira DevOps triggers, EXCPT for moving a ticket to Ready For QA, once it has two reviews.

For that step, we are using a webhook. It took a lot of trial and error, but we have a system that almost works. the only thing we are struggling with is actually matching up the git pull requests webhook info to the correct jira ticket. Right now we have our automatrion rule firing off a slack notification, but we need it to actually move the ticket. So this last bit is pretty important! We have these three options available to us in the trigger:

2022-08-09 14_00_35-Automation - Prodigy JIRA.png

Tried the first, but no luck. We are apparently not providing issues in our webhook data:

2022-08-09 14_07_26-Automation - Prodigy JIRA.png

Been fiddling around with some whackadoodle JQL (option two from the above list) trying to make some magic happen, but no luck yet. So im here looking for some help.

Has anyone out there gotten an incoming webhook trigger (from git, and yes we have the plugin installed) to correctly match up with the proper issues using the "Issues provided in the webhook HTTP POST body" option? And if so, how do we set up our git instance to preform this arcane ritual of immense power?

2 answers

1 accepted

1 vote
Answer accepted
Chris Carpenter September 15, 2022

Ok, coming back to this just to give a small update.

We made the system a lot simpler. Using git hub actions, our git PRs will label themselves with a Ready For QA label when they get two reviews.

 

Automation for jira is now just waiting to receive a webhook with the labeled action that contains the label name Ready For QA. If it does, it runs a quick bit of JQL to find the jira ticket that's in the In Review workflow status with a PR number that matches the PR number in the webhook data - and if all that matches automation for jira moves the ticket.

Works really well!

0 votes
Chris Carpenter August 12, 2022

Figured out probably the wrong way to do this, but it works

In our workflow, when a pull request is created, we use the pull request created automation trigger to scootch the jira ticket into the ready for review status. I added a hidden custom field called PR number. And when the pull request created trigger fires off, the custom field gets populated with this "{{pullRequest.url.remove("https://github.com/YOUR_INFO_HERE/pull/")}}". That will populate the custom field with the pull request number, and give we a way to find the ticket again with dat from the webhook

When the incoming webhook trigger fires off, I have the "issues provided by the following JQL search" option checked. the JQL is then (project = "YOUR_PROJECT" AND "YOUR_CUSTOM_FIELD" ~ {{webhookData.pull_request.number}})

And with that, the incoming webhook trigger now has access to the data form the webhook, and knows about the jira ticket(s) that match up Webhooks PR.

I don't know if that made sense or not, but it seems to work. And once the automation for jira rule has both the incoming webhook data, and the ticket that im looking for, I can use the webhook data to manipulate the ticket. If there is a better way to do this, please leave a note. I would love for the solution to this problem to have fewer moving parts!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events