Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to create Jira Automation Rule using a Wedhook "Pull Request Review" from Github

Olga Buslovich April 16, 2021

Ive created a rule using the Github Webhook with the "Pull Request Reviews" and "Pull Request" events selected to automate the process for moving the JIRA issues to "QA" when a pull request is "approved" in Github

However, it doesn't work as expected. For some reason the payload that got sent and shown in the Rule Audit log in JIRA doesn't include the "action" or "state" like "approved".

Here is the rule conditions

image (11).png

Has anyone tried something similar? Any ideas / suggestions are helpful and very much appreciated !!

4 answers

1 vote
Olga Buslovich May 1, 2021

I got an update from the JIRA Support on this issue and would like to share here so it might save some of your in case you run into the similar or related issue when using Webhook with A4J.

It turned out that this is a known bug in automation for Jira  (A4J) that ignores the incoming webhook headers and the state of the PR is provided inside the webhook header and this information is completely removed from the incoming webhook when being processed by A4J. 

As an FYI,  here is the ticket that was created to address this problem: https://jira.atlassian.com/browse/JRACLOUD-76534 

BTW, @Simmo  has reported that issue back in 2019 https://codebarrel.atlassian.net/browse/AUT-1826 it's still in Backlog till now :(

Hope it gets prioritized and fixed sooner this time.

Thanks to ALL who help with the feedback and for sharing your expertise!!

Best,

Olga

Ajayi George
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2024

Hi, is there now a workaround for this?  I need help to automate the creation of dependabot tickets from GitHub to Jira using webhooks  but the payload that got sent and shown in the Rule Audit log in JIRA doesn't include some fields like 'security_advisory' in my case, please check this out for more details, I asked a question about this.

https://community.atlassian.com/t5/Jira-Software-questions/Hello-I-need-help-to-automate-the-creation-of-dependabot-tickets/qaq-p/2597879

1 vote
Olga Buslovich April 18, 2021

Thanks for your reply @Simmo !!

Now that I know that there are no access permissions involve  then I've moved on and tried the @Darryl Lee  suggestion.

So I have created a rule and im getting data like the Pull Request number , State (e.g. OPEN) in the Webhook payload json . However, the Pull Request Reviews events that i'm looking for  e.g.  PENDING. or APPROVED or  are not there

Here is what I'm expecting based on the Github documentations:

image (12).png

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2021

Hi @Olga Buslovich , could you provide an example of what you're getting? That's the easiest way to figure it out.

Olga Buslovich April 18, 2021

Hi @Simmo ,

RuleAuditLog.png

Olga Buslovich April 18, 2021

@Simmo  Thanks for looking :)lga

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2021

Hi @Olga Buslovich

I'm afraid its been cut off, so its hard to tell but one thing to check is if the information that you're after has been included. With github, some information is optional and needs to be ticked to be included in the webhook.

Cheers,

Simeon.

Like Olga Buslovich likes this
Olga Buslovich April 18, 2021

Thank YOU @Simmo !!

Actually the Log I've shared has all the data that i got (no cut off ). I'll open a ticket  with Github. Thanks again!! 

Best,

Olga

1 vote
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 16, 2021

Hey there:

Would you be able to paste in the URL (feel free to obscure the hostname) of your webhook request?

I'm thinking that you might not need pull_request_review as that's part of the URL, not what gets returned by the request.

(Reference: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review)

So then, I would try adding a "Log action" of:

State: {{webhookData.review.state}} / Action: {{webhookData.review.action}}

To see if that's returning what you're looking for.

(Learn more about "log action" in the Debugging your first rule documentation.)

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 16, 2021

OH. Reading the article How to integrate Jira and GitHub using Automation for Jira, @Simmo actually includes pull_request in Smart Values used for creating an issue from a webhook.

I guess the best way to check for sure whether you need to include pull_request_review is to follow the same steps, which is to add a "Log action" of:

{{webhookData}}

Which will allow you to see the full JSON payload, and then figure out what Smart Value you should use to get "state" and "action".

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 16, 2021

If you can do this and paste take a screenshot or paste what the JSON payload is (obfuscating any confidential data), we could help figure out what the Smart Values should be.

Olga Buslovich April 16, 2021

Thanks for your response @Darryl Lee !!

Actually, I was using the @Simmo article as a base for creating conditions in my rule and found very helpful - Thanks @Simmo !!

Before going any further, I'd like to double check if there are any additional permission / access level requirements on the Github side needed to be able to receive and  see all the webhook actions / events for the JIRA user who is the owner of the rule?

For Exp, I have Admin privileges for JIRA  but I do not Admin for the Github repo and I've asked the Dev Team Lead to create the Webhook for me b/c i do not have the admin permissions for that repository. Is this could be a problem for me not getting all the events / actions in the JSON payload?

Please advise.

TIA!!

Olga

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2021

Hi @Olga Buslovich,

You shouldn't have any issues with that. Webhooks are not authenticated so you'll be able to receive it okay.

To try and figure out your smart values, take the advice from @Darryl Lee and log out the webhook data. That will show you everything you can access.

Cheers,

Simeon.

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2021

Hi - I was doing some work with a client who had connected their Github instance to Jira using the built-in integration, which I believe eliminates the need to get pull request information via a Webhook.

https://support.atlassian.com/jira-cloud-administration/docs/integrate-with-github/

Is there a reason why you can't use that integration?

Olga Buslovich May 1, 2021

Hi @Darryl Lee ,

Thank you for following up!!

I've took a look and I believe that our JIRA is already connected to the Github (see attached screenshot).image (13).pngBut I'm not sure how to use this integration in creating the automation rule that will move JIRA issues to a certain state e.g. "Awaiting Code Review" or "QA" when PR gets set to "Request Review" or  "Approved"  in Github.

I would really appreciate if you share any additional info on that

TIA,

Olga

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events