Dev Ops · n8n

Automatically Move Jira Issues to Done When a GitHub PR Is Merged

When a pull request is merged on GitHub, this workflow instantly transitions the linked Jira issue to a 'Done' status — no manual updates needed. Dev teams save time and keep project boards accurate without any extra clicks.

difficulty Intermediatesetup 45 minresult Every merged GitHub PR automatically moves its linked Jira issue to Done, keeping your sprint board up to date in real time.
  1. 1

    Listen for GitHub Pull Request Events

    Add a GitHub Trigger node. Set Events to pull_request. Enter your repository owner and repo name. n8n will register a webhook on GitHub automatically. Every pull request event — opened, closed, merged — will fire this trigger.

  2. 2

    Filter for Merged PRs Only

    Add an IF node connected to the trigger. Create a condition: {{$json["body"]["action"]}} equals closed AND {{$json["body"]["pull_request"]["merged"]}} equals true. Only truly merged PRs will pass through; rejected or simply closed PRs will be ignored.

  3. 3

    Extract the Jira Issue Key from the PR

    Add a Set node on the TRUE branch of the IF node. Create a field named issueKey. Use the expression {{$json["body"]["pull_request"]["title"].match(/[A-Z]+-[0-9]+/)?.[0]}} to pull the Jira issue key (e.g. PROJ-123) out of the PR title. Make sure your team includes the Jira key in every PR title, for example: PROJ-123: Add login feature.

  4. 4

    Look Up the Transition ID for Done

    Add an HTTP Request node. Set Method to GET and URL to https://your-domain.atlassian.net/rest/api/3/issue/{{$json["issueKey"]}}/transitions. Under Authentication, choose Basic Auth and enter your Jira email and an API token from id.atlassian.com. This returns available transitions so you can confirm the numeric ID for your Done transition (commonly 31 or 41). Note that ID in the next step.

  5. 5

    Transition the Jira Issue to Done

    Add a second HTTP Request node. Set Method to POST and URL to https://your-domain.atlassian.net/rest/api/3/issue/{{$node["Set"]["json"]["issueKey"]}}/transitions. Set Content-Type header to application/json. In the Body field (JSON mode) enter: {"transition":{"id":"31"}} — replace 31 with the transition ID you found in the previous step. Use the same Basic Auth credentials. The Jira issue will now move to Done.

Frequently asked questions

What if my PR title doesn't contain a Jira issue key?

The regex in the Set node will return null and the HTTP Request will fail gracefully. Establish a team convention to always prefix PR titles with the Jira issue key (e.g. PROJ-123: description). You can also add an extra IF node to check that issueKey is not empty before making the API call.

How do I find the correct transition ID for my Jira project?

Run the GET transitions request manually (Step 4) using a tool like Postman or by temporarily enabling the HTTP Request node and checking its output. Look for the transition whose name is 'Done' or matches your workflow's final status, then copy its `id` value into Step 5.

Can I transition to a status other than Done, like 'In Review'?

Yes. Repeat the lookup in Step 4 and find the ID for any status you want, then use that ID in Step 5. You could even duplicate the workflow and trigger a different transition when a PR is opened (action = opened) to move the issue to 'In Review' automatically.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.