Is there an automation rule option for Pull Request Approved?

Esty Heller June 9, 2020

I want to automatically transition issues to "Awaiting Release" status, once the pull request is approved. This tells me that it will be merged soon and no one needs to do more work on it. For now, I need the reviewer to manually move it to that status.

2 answers

0 votes
Nitin Bhosale April 5, 2022

@Muhammad Ramzan_Atlassian Certified Master_ Can we auto approve all commits automatically when workflow transition change? For example transition changed from In Review to Ready For QA then I have to approve all commits automatically on my repo in bitbucket.

Appreciate your help, Thanks in advance !!!

0 votes
Muhammad Ramzan_Atlassian Certified Master_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2020

Create trigger on your jira workflow and then select the bibucket option , once pull request is approved this trigger will be triggered and transition will be changed.

 

https://confluence.atlassian.com/adminjiracloud/configuring-workflow-triggers-776636696.html

Esty Heller June 9, 2020

Thanks for the reply.

Pull request Approved is not on the list of available triggers for workflow transitions.

In addition, I want to be able to do this from the new automation rules.

Muhammad Ramzan_Atlassian Certified Master_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2020

My mistake i did not read about the pull request trigger.

If you have  automation for jira then you can achieve this as follow.

 

  • In jira automation create a webhook 
  • Configure that webhook inside your bitbucket repo and select the event pull request approved.
  • On jira for automation, add rules once webhook is triggered, transition he issue to your required state.
Esty Heller June 9, 2020

What is "jira for automation"? Is that an add-on?

Muhammad Ramzan_Atlassian Certified Master_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2020

If you using jira cloud by default you will have automation for jira plugin if you using server then its separate plugin provided by jira

Lissa Meade
Contributor
December 22, 2020

@Muhammad 

I'm not really familiar with webhooks, so bear with me....  Here's my goal:

  1. ANY ticket connected to a project's Bitbucket repo is worked on by a developer, who submits a pull request. The ticket transitions to "Code Review" status and assigns the ticket to the technical architect. 
  2. The technical architect approves the pull request which triggers the automation rule which reassigns the ticket to the original developer and transition the ticket to "Code Approved" status.

Q1: What option do you select for the webhook? 

  1. Issues provided in the webhook HTTP POST body
  2. Issues provided by running the following JQL search
  3. No issues from the webhook

Q2: How does Jira find the associated ticket for any given pull request from the repo? Would I add a step to look up a ticket somehow or does it connect automatically? 

Q3: Do I need a JQL Condition in place with a query like this?

assignee WAS in (557058:7f4cc0f9-6748-4551-8f01-ebf780d212e7) AND assignee in (557058:b05d092f-0845-429d-b6e3-80f1442ae8b1) AND project = FSS AND status = "CODE REVIEW"

I assume that it would be best to filter the tickets so that the correct developer was assigned, but with multiple developers on this project I wonder if there is an easier way to do this all together. 

In other words: How would you configure this automation rule, exactly?

Like Arron Fletcher likes this
Muhammad Ramzan_Atlassian Certified Master_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2020

You can use built in triggers by jira automation , here are the guidelines 

https://www.atlassian.com/nl/software/jira/automation-template-library/bitbucket-github-gitlab

https://support.atlassian.com/jira-software-cloud/docs/smart-values-development/

 

In your commit message, jira issue key must exist then automation will know for which issue this rule will be executed.

Lissa Meade
Contributor
January 13, 2021

Sorry, but pull request approvals don't exist in the built in triggers in Jira Automation, so I'm not sure what I'm looking for in the documentation. How did you configure the webhook to pull in the title/issue ID and user ID from the pull request POST body?

Like Arron Fletcher likes this
Muhammad Ramzan_Atlassian Certified Master_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2021

@Lissa Meade , Pull request approval trigger does not exist. To achieve this , please follow the steps as below.

You need to perform some steps on Jira & Bitbucket side.

 

  • On Jira side create automation rule and trigger should be "Incoming Webhook", copy the url
  • Now go to Bitbucket. Repo setting >Webhooks.
  • Past the url which you copied from the jira automation rule.
  • Select the Approved check box
  • Go back to Jira and add a new action on same automation , process the webhook json and then you can perform the required actions.

 

Below is the link for your guide, its not same as you trying to achieve but it will give you the flexibility to implement your automation rule.

https://blog.codebarrel.io/how-to-integrate-jira-and-github-using-automation-part-2-5eb816f2b947

2021-02-07_14-31-50.png2021-02-07_14-31-36.png

Like # people like this
Christopher Piwarski
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!
January 25, 2022

Hello Muhammad,

Is there any movement on this issue? We would like to be able to implement more formal rules based on bitbucket pr approvals. If not, can you rehost the information that was on codebarrel? The link seems to have expired. Thank you.

Like Tania Samusina likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events