AutomationFlowsAI & RAG › Gitflow: 2 - Branch & PR Creation

Gitflow: 2 - Branch & PR Creation

Gitflow: 2 - Branch & PR Creation. Uses githubTrigger, github. Event-driven trigger; 3 nodes.

Event trigger★☆☆☆☆ complexity3 nodesGithub TriggerGithub
AI & RAG Trigger: Event Nodes: 3 Complexity: ★☆☆☆☆

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Gitflow: 2 - Branch & PR Creation",
  "nodes": [
    {
      "parameters": {
        "githubApi": "YOUR_GITHUB_API_CREDENTIAL_ID",
        "events": [
          "issues.opened"
        ]
      },
      "name": "GitHub Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "owner": "eivindingebrigtsen",
        "repository": "agent",
        "operation": "createBranch",
        "branchName": "={{ 'feature/issue-' + $json.body.issue.number + '-' + $json.body.issue.title.toLowerCase().replace(/ /g, '-') }}",
        "sourceBranchName": "master"
      },
      "name": "GitHub: Create Branch",
      "type": "n8n-nodes-base.github",
      "typeVersion": 3,
      "position": [
        500,
        300
      ],
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "owner": "eivindingebrigtsen",
        "repository": "agent",
        "operation": "createPullRequest",
        "title": "={{ 'WIP: ' + $json.body.issue.title }}",
        "head": "={{ 'feature/issue-' + $json.body.issue.number + '-' + $json.body.issue.title.toLowerCase().replace(/ /g, '-') }}",
        "base": "master",
        "body": "={{ 'Closes #' + $json.body.issue.number }}",
        "draft": true
      },
      "name": "GitHub: Create PR",
      "type": "n8n-nodes-base.github",
      "typeVersion": 3,
      "position": [
        750,
        300
      ],
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "GitHub Trigger": {
      "main": [
        [
          {
            "node": "GitHub: Create Branch",
            "type": "main"
          }
        ]
      ]
    },
    "GitHub: Create Branch": {
      "main": [
        [
          {
            "node": "GitHub: Create PR",
            "type": "main"
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "2"
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

About this workflow

Gitflow: 2 - Branch & PR Creation. Uses githubTrigger, github. Event-driven trigger; 3 nodes.

Source: https://github.com/eivindingebrigtsen/agent/blob/e0b57ed02a522ed6adc2b1c58c5feadf427d4a80/.n8n/workflow-2-branch-creation.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →