Sync Jira with your git provider

Developers do their best work in focus mode and updating work can sometimes be an unwanted distraction. Using automation rules such as this one, you can ensure that developers can stay in code mode but Jira will still be up to date and the central source of truth.

In this rule, when a Pull Request is merged, if the status is 'In Review' and there are no open pull requests, automation will transition the issue to 'done' and add value to the audit log. 

Syncing Jira to git products
The automation recipe
The automation recipe

Step 1: Choose your trigger

Every rule starts with a trigger. In this case, it will be the ‘Pull request merged’ trigger. Whether you use Bitbucket or a third party tool like GitHub or GitLab - you will need to link the accounts first. Learn how to do that here. You only have to do this setup once, the first time you create a DevOps rule.

Choose pull request merged

Step 2: Add your condition

A condition refines the rule so it won’t act too broadly. Here, we add the ‘Issue fields’ condition, specifying that status is ‘In Review’

Adding issue fields condition

Step 3: Add JQL condition

Now, we add another condition. The Issue fields condition is easier to use but the JQL condition can get much more granular. This time we are going to choose the JQL condition to do just that.

We use JQL here to tell automation to ensure there are no open pull requests still to do. The JQL for this in our case is development[pullrequests].open = 0

Adding JQL condition

Step 4: Add ‘Transition issue’ action

The action we want to choose here is to transition the issue to ‘Done’.

Adding ‘Transition issue’ action

Step 5: Add another action

You can add multiple actions. In this case, we simply want to add a value to the audit log as we might want to use this in a later rule. Here we use a smart value: {{issue.key}} has been merged.

Adding log action

Step 6: Test it!

It is best to test rules like this out on a free personal instance of Jira first or in a sandbox to ensure everything is running smoothly. As ever, follow the audit log for breadcrumbs of all activity.

The automation recipe

Learn more about Jira automation

How to automate across Jira and GitLab (relevant for any Git provider)

An intro to smart values

Demo-den introduction to DevOps automation

One page with all helpful Jira automation resources

Other rules that you may find useful

Jira logo and person icon showing how to auto assign issues
Assign Issues

Auto-assign issues

When an issue is raised without an assignee, auto-assign to whoever created it

Jira logo and sync icon showing how to sync work
Sync Issues

Sync work

When an epic is marked as ‘done’ move all its stories to ‘done’ also.

Jira and Slack logos

Daily Slack summary

Send a daily Slack message with a list of issues still open in the Sprint.

Jira logo and pen icon showing how to auto sum up story points

Sum up story points

When a new sub-task is created, sum up its story points to the parent.

Jira logo and confluence logo

Automatically publish a post-incident review (PIR) in a linked Confluence space New

This rule will automatically create a Confluence page for PIR or post-mortem when an incident is created.