n8n and Claude Code: automate GitHub pull requests

Build two n8n workflows that turn GitHub issues or Slack requests into pull requests using Python, headless Claude Code and the GitHub CLI.

Player not loading? Watch on YouTube

This tutorial builds a coding assistant around two n8n workflows. The first responds to GitHub issues and runs a Python script on the host machine. The script prepares a repository branch, passes the issue title and body to Claude Code, commits and pushes the changes, then creates a pull request through the GitHub CLI. A Slack message reports completion. The demonstrated requests include README edits and a minimal Flask application.

The second workflow accepts Slack channel messages. An OpenAI-powered AI agent converts each request into an issue title and body using structured output. Creating that GitHub issue triggers the first workflow. The speaker describes this as a way for nontechnical colleagues to request changes while leaving final approval to a developer.

The setup uses self-hosted n8n because the workflow needs its Execute Command node. The speaker installs it on Arch Linux with npm and Node.js 22, and uses ngrok to expose port 5678 for incoming webhooks. Configuration covers GitHub tokens, Slack bot permissions and event subscriptions, an OpenAI API key, and local repository authentication. The Execute Command node must be explicitly enabled, and Claude Code runs headlessly with edit permissions. Although commands execute on the host, the workflow depends on external services. n8n sponsors the video.