How to Connect n8n to GitHub: Automate Your Dev Workflow (2025)
GitHub is the hub of most engineering teams, and its rich webhook and REST API make it a natural fit for n8n. You can trigger automations on every push, comment on pull requests, auto-label issues, sync releases to Slack, and even run AI code reviews — all without maintaining a separate bot server.
This guide covers authenticating with a personal access token, listening to repository events, and acting on them from n8n.
What GitHub automations look like in n8n
Because GitHub emits webhooks for nearly everything, n8n can react to your team's real workflow:
- PR notifications — post new pull requests to a review channel with author, files changed, and a summary.
- Issue triage — auto-label, assign, and prioritize new issues using AI classification.
- Release announcements — turn a new tag into a formatted changelog posted to Slack, Discord, or a blog.
- AI code review — fetch the diff on every PR and have an LLM flag bugs and style issues as a comment.
Step 1 — Create a GitHub personal access token
For most automations a fine-grained personal access token is safest:
- Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens.
- Scope it to the specific repositories n8n should touch.
- Grant only the permissions you need — typically Contents: Read, Issues: Read/Write, Pull requests: Read/Write.
- Copy the token immediately.
Fine-grained tokens beat classic tokens because you can lock them to one repo and a minimal permission set.
Step 2 — Add the GitHub credential in n8n
In n8n, open Credentials → New → GitHub API, choose Access Token, and paste your token. Save and test. For OAuth-based multi-user setups you can instead register a GitHub OAuth app and use the GitHub OAuth2 credential, but a PAT is simpler for internal automations.
🚀 Give every pull request an instant AI reviewer
This workflow fetches the diff on each new PR, runs it through GPT-4o, and posts a structured review comment automatically — the pattern from Step 4, ready to deploy.
Get the AI Code Review template →
Step 3 — Trigger on pushes, PRs, and issues
Add the GitHub Trigger node, select your repository, and choose the events to listen for — push, pull_request, issues, release, and more. n8n automatically registers the webhook on the repo for you. When the event fires, the full payload flows into your workflow, so you can read the PR number, branch, author, and changed files directly.
Filter early with an IF node — for example only continue when action = opened — to avoid running your logic on every minor event.
Step 4 — Act on the repository
The GitHub action node covers the rest: create or comment on issues, create pull requests, add labels, dispatch workflows, and read file contents. A classic pattern is fetching a PR's diff via the API, sending it to an AI node, and posting the review back as a PR comment — an automated first-pass reviewer that never sleeps.
Troubleshooting
- Trigger not firing — the token lacks webhook permission, or n8n isn't reachable at a public HTTPS URL.
- 404 on API calls — the fine-grained token isn't scoped to that repository.
- Rate limited — batch requests and cache results; authenticated requests get 5,000/hour.
- Duplicate runs — GitHub retries webhooks; make downstream actions idempotent.
Ship faster with automated dev workflows
With a scoped personal access token and the GitHub trigger, n8n becomes an automation layer over your entire development process. The highest-leverage starting points are PR notifications and automated code review — both remove friction from the daily loop without changing how your team already works.
Keep tokens fine-grained, make actions idempotent to survive webhook retries, and expand from there.
Ready to automate? Get this n8n template on Gumroad
Get the automated AI Code Review workflow — GPT-4o reviews every pull request and comments inline, out of the box.