Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 to create Jira Automation Rule using a Wedhook "Pull Request Review" from Github

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
Darryl Lee Community Leader Apr 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 Apr 16, 2021

OH. Reading the article How to integrate Jira and GitHub using Automation for Jira, @Simeon Ross 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 Apr 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.

Thanks for your response @Darryl Lee !!

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

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

Simeon Ross Atlassian Team Apr 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.

Thanks for your reply @Simeon Ross !!

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

Simeon Ross Atlassian Team Apr 18, 2021

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

Simeon Ross Atlassian Team Apr 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

Thank YOU @Simeon Ross !!

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

0 votes
Darryl Lee Community Leader Apr 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?

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

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, @Simeon Ross  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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Automation

Announcing the Jira automation template library!

Hi all,  After many months of work, I am delighted to announce the launch of the Jira Automation Template Library!  The Template Library is a new website dedicated to all things Jira au...

1,134 views 20 27
Read article

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