Back to Templates

Automate GitHub PRs & JIRA Updates from Git Commit Commands-Single Repo

Created by

Created by: Intuz  || intuz

Intuz

Last update

Last update 2 days ago

Categories

Share


Description

Streamline your development workflow by creating GitHub pull requests and updating JIRA issues automatically based on commands in your git commit messages.

Save developer time, eliminate context switching, and reduce manual errors.

How it works

This workflow acts as a powerful bridge between your Git repository and your project management tools, driven entirely by the structure of your commit messages.

  1. GitHub Webhook Trigger:
    The workflow starts when a developer pushes a new commit to a specified repository in GitHub.

  2. Parse Commit Message: A Code node extracts key information from the commit message:

  • The JIRA Issue Key (e.g., FF-1196).
  • The base branch for the PR (e.g., development).
  • Action commands like [auto-pr] and [taskcompleted].
  1. Conditional PR Creation: An IF node checks if the [auto-pr] command is present.
  • If yes, it uses the GitHub node to automatically create a pull request from the developer's branch to the specified base branch.
  • If no, this step is skipped, allowing for multiple commits before a PR is made.
  1. Conditional JIRA Update: Another IF node checks for the [taskcompleted] command.
  • If yes, it uses the JIRA node to transition the corresponding issue to your "Done" status (e.g., "Task Completed" or "In Review").
  • If no, the JIRA issue remains in its current state, perfect for work-in-progress commits.

How to Use: Quick Start Guide

  1. Click the "Use Template" button to import this workflow into your n8n instance.

  2. Configure the GitHub Trigger:

  • Open the "GitHub Push Trigger" node. It will display a unique Webhook URL. Copy this URL.
  • In your GitHub repository, go to Settings > Webhooks > Add webhook.
  • Paste the URL into the Payload URL field.
  • Set the Content type to application/json.
  • Under "Which events would you like to trigger this webhook?", select Just the push event.
    Click Add webhook.
  1. Connect Your Accounts:
  • GitHub: Select your GitHub API credential in the "Create Pull Request" node.
  • JIRA : Select your JIRA API credential in the "Update JIRA Issue Status" node.
  1. Customize the JIRA Transition (Important):
  • Open the "Update JIRA Issue Status" node.
  • In the Transition parameter, you need to set the specific status you want to move the issue to (e.g., 'Done', 'Completed', 'In Review'). You can use the ID or the exact name of the transition from your JIRA project's workflow.
  1. Activate the Workflow: Save your changes and activate the workflow. You're ready to automate!

Example Commit Message:

git commit -m "FF-1196 Implement OAuth login [auto-pr,development,taskcompleted]"

Key Requirements to Use Template

  • An active n8n instance.
  • A GitHub account with repository admin permissions to create webhooks.
  • A JIRA Cloud account with permissions to update issues.
  • Developers who can follow the specified git commit message format.

Connect with us