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.
- 1
Listen for GitHub Pull Request Events
Add a
GitHub Triggernode. SetEventstopull_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
Filter for Merged PRs Only
Add an
IFnode connected to the trigger. Create a condition:{{$json["body"]["action"]}}equalsclosedAND{{$json["body"]["pull_request"]["merged"]}}equalstrue. Only truly merged PRs will pass through; rejected or simply closed PRs will be ignored. - 3
Extract the Jira Issue Key from the PR
Add a
Setnode on the TRUE branch of the IF node. Create a field namedissueKey. 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
Look Up the Transition ID for Done
Add an
HTTP Requestnode. SetMethodtoGETandURLtohttps://your-domain.atlassian.net/rest/api/3/issue/{{$json["issueKey"]}}/transitions. UnderAuthentication, chooseBasic Authand 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 (commonly31or41). Note that ID in the next step. - 5
Transition the Jira Issue to Done
Add a second
HTTP Requestnode. SetMethodtoPOSTandURLtohttps://your-domain.atlassian.net/rest/api/3/issue/{{$node["Set"]["json"]["issueKey"]}}/transitions. SetContent-Typeheader toapplication/json. In theBodyfield (JSON mode) enter:{"transition":{"id":"31"}}— replace31with 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.