AutomationFlowsAI & RAG › Automate GitHub Branch & PR Creation

Automate GitHub Branch & PR Creation

Original n8n title: 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: ★☆☆☆☆ Added:

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

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 →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automatically handles new GitHub issues by reading and understanding them using AI, then taking multiple actions simultaneously — creating tasks, sending notifications, and keeping every

Github Trigger, Slack, OpenAI +5
AI & RAG

Engineering teams, code reviewers, and tech leads who want to automate code review feedback. Ideal for repositories with high PR volume where consistent first-pass review is valuable.

Github Trigger, HTTP Request, OpenAI +2
AI & RAG

This workflow creates an image with the new OpenAI image model "GPT-Image-1" based on a form input. Form trigger (image prompt and image size input) Generate the Image via OpenAI API. Return the image

Form Trigger, HTTP Request, Form
AI & RAG

Automated Form Submission Data Storage in Airtable. Uses formTrigger, airtable, stickyNote. Event-driven trigger; 4 nodes.

Form Trigger, Airtable
AI & RAG

Gitflow: 5 - Review Triage. Uses githubTrigger, aiAgent, github. Event-driven trigger; 4 nodes.

Github Trigger, Ai Agent, GitHub