Webhook project automation rule not working from github
Asked by Christopher Y. Horvat:

Problem: I have configured github to send a a post to a Jira Webhook automation rule and while the automation rule is finding the correct issue in Jira via JQL and smart values {{webhookData.pull_request.head.ref}}. The conditions in the webhook automation rule are not matching for some reason  
![Untitled.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/338992i5023151C17DEBA6D/image-size/large?v=v2&px=999 "Untitled.jpg")  

the conditions in the rule are configured as follows  
![Untitled.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/338994i218A80C23A9A4966/image-size/large?v=v2&px=999 "Untitled.jpg")

First value: {{webhookData.pull_request.merged}}  
Condition: equals  
Second value: true  

First value: {{webhookData.pull_request.base.ref}}  
Condition: equals  
Second value: dev  

<br />

First value: {{webhookData.pull_request.action}}  
Condition: equals  
Second value: closed  

I have looked at the conditions and looked at the json and looked at smart values, and I can't seem to find a reason why this rule will not work. I could use a second set of eyes to tell me what I am doing wrong.


Answers:
author: Abyyba
body: Hello [@Christopher Y. Horvat](/t5/user/viewprofilepage/user-id/5556933) ,

<br />

I noticed something while your comment you reference "{{webhookData.pull_request.**head** .ref}}"  

In the screenshoots reference is made to "{{webhookData.pull_request.**base** .ref}}"  

Just to confirm, is **base.ref** correct instead of **head.ref**?

<br />

From experience I would say that if a rule says that it fails, it is because it fails, that is, because the value is not what was expected.  
How sure are we that these values are sent and reach the automation at that exact point with the expected value?  

<br />

To debug, I invite you to try the following.  

You can create some initial variable at the beginning of the automation where you store the information that arrives in the different variables that you hope to check, otherwise, you can apply the solution directly.  

{{webhookData.pull_request.merged}}  
{{webhookData.pull_request.base.ref}}  
{{webhookData.pull_request.action}}  

And while we're at it, why not too?  
{{webhookData.pull_request.head.ref}}  

Now, use a new action to add a comment to the task with the values of these variables before checking. If those variables have data, they should be added to the comment, which will allow you to know what it contains at that exact point of execution.  

Ultimately, I would check the type of the values. It wasn't really checking "1" vs "true".  

<br />

<br />

The truth is that it is very clear and I can't think of anything else, I hope it can be of help.  

<br />

Regards,  
Sergio G.  

comments: author: Christopher Y. Horvat
body: I will give that a try so I can see the values as Jira is seeing them. But I have looked at the JSON payload from github and the values are definitely boolean and strings. So not sure why the if statement is not matching.


author: Christopher Y. Horvat
body: Thanks to Sergio, I was able to determine what I was missing with my own to eyes. The smart value I was using for action {{webhookData.pull_request.action}} is not an actual value, it should have been {{webhookData.action}}. Once I fixed that the conditions started working as expected and we now have github base and ref based issue transition rules! Yay!


author: Abyyba
body: I'm glad I could help and share something new! It's happened to me too---being 100% sure about a value, but nothing beats seeing it at runtime. ?

If you ever have any more questions, don't hesitate to ask! We're always here to help.  

Regards,  
Sergio G.  
Abyyba Team


Tags: cloud

jira-cloud