Get Started
Screenshot of n8n workflow
FREE TEMPLATE
Automate GitHub PR Code Review
11
Views
0
Downloads
14
Nodes
Download Template
Free
Preview Template
Utility Rating
7 / 10
Business Function
IT
Automation Orchestrator
n8n
Integrations
OpenAI
Google Sheets
GitHub
Trigger Type
On app event
Approx setup time ≈ 45 min
Need help setting up this template?
Ask in our free Futurise community
About
Community
Courses
Events
Members
Templates

How to Automate GitHub PR Code Review?

Leon Petrou
FREE TEMPLATE
Automate GitHub PR Code Review
11
Views
0
Downloads
14
Nodes
Download Template
Free
Preview Template
Utility Rating
7 / 10
Business Function
IT
Automation Orchestrator
n8n
Integrations
OpenAI
Google Sheets
GitHub
Trigger Type
On app event
Approximate setup time ≈ 45 minutes
Need help setting up this template?
Ask in our free Futurise community

Description

Pull requests pile up. This setup posts an AI code review on every new PR, adds a clear label, and follows your team rules from a Google Sheet. It helps engineering teams speed up reviews and keep a steady quality bar.

When a pull request opens, the GitHub event starts the run. The HTTP Request step collects changed files and diffs from the GitHub API. A Code step formats those diffs into a short, structured prompt. The OpenAI Chat Model powers a Code Review Agent that reads the prompt and your best practices from Google Sheets, then writes a helpful review. A GitHub action posts the comment to the PR and can apply a ReviewedByAI label for easy tracking. The flow reduces back and forth, makes feedback consistent, and shortens the time to merge.

You will need GitHub access, an OpenAI key, and a Google Sheet with your rules. Expect review time per PR to drop from about 30 minutes to under 5 minutes, with more consistent feedback across the team. Great for small teams, open source maintainers, and squads that triage many PRs each day.

Copy link

Tools Required

OpenAI
Sign up
Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens
n8n
Sign up
$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.
Google Sheets
Sign up
Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)
GitHub
Sign up
Free tier: $0 / mo

What this workflow does?

  • PR event trigger starts the run as soon as a pull request is opened or updated.
  • HTTP Request step fetches changed files and diffs from the GitHub API.
  • Code step formats diffs and filenames into a clean prompt for the AI.
  • OpenAI Chat Model generates a focused review based on the diffs.
  • Google Sheets tool lets the agent read your team’s best practices during review.
  • Agent composes practical comments with suggestions and risks.
  • GitHub action posts the review as a PR comment for the team to see.
  • Optional labeler marks the PR as ReviewedByAI for easy tracking.

What are the benefits?

  • Reduce manual review time from 30 minutes to 5 minutes per PR
  • Automate about 70% of first pass code checks
  • Improve guideline adherence by 50% using shared best practices
  • Speed up PR triage with automatic ReviewedByAI labels
  • Connect GitHub, OpenAI, and Google Sheets in one flow

How to set this up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with GitHub, OpenAI and Google Sheets. See the Tools Required section above for links to create accounts with these services.
  3. Open the PR Trigger node. In the credential dropdown, click Create new credential and connect your GitHub account with OAuth. Fill in the repository owner and repository name. Make sure the event is pull_request.
  4. Open the GitHub Robot node. In the credential dropdown, create or select your GitHub API credential. Set the owner and repository. Keep the pull request number expression as provided. Ensure the operation posts a review comment.
  5. Open the Add Label to PR node. Use your GitHub OAuth credential. Set the repository and confirm the issue number expression. Keep the labels field to include ReviewedByAI.
  6. Open the HTTP Request node. If your repo is private, add an Authorization header with a GitHub token. For public repos this may not be needed. Keep the URL expression that reads files from the PR.
  7. Open the Code node that builds the prompt. Review the prompt text and adjust tone, severity, and coding focus to match your team standards. Save your changes.
  8. Open the OpenAI Chat Model node. Click Create new credential and paste your OpenAI API key. Choose the model set in the template or select another model if needed.
  9. Open the Google Sheets tool node. Click Create new credential and connect your Google account. Paste the Document ID and set the Sheet name that stores your rules and examples.
  10. Open the Code Review Agent node. Confirm it uses the OpenAI model and the Google Sheets tool. Save the workflow.
  11. Create a test PR in your GitHub repo. Watch the n8n execution. Confirm a review comment appears and the label is added.
  12. If the trigger does not fire, check the repo Webhooks page to confirm n8n registered a webhook and that n8n is reachable. Reconnect GitHub credentials if needed.
  13. If the comment is empty or truncated, limit large diffs or reduce file count in the Code node. If Google Sheets content is not read, verify the Document ID, Sheet name, and Google permission.

Need help or want to customize this?

Similar Templates

n8n
IT
Automate GitHub to Telegram Bug Alerts
Get quick updates on important GitHub bugs without opening your browser. Every ten minutes, new or active issues are checked and the right alerts are sent to Telegram. It helps engineering and product teams act faster and cut noise. A scheduled check looks for open issues with a Bug label from the last 30 minutes. The flow pulls each issue, keeps key fields like title, link, created time, and comment count, then filters by comment activity so you only see items people are discussing. A short Telegram message sends the title and a direct link to your user or group chat. This keeps attention on issues that matter and reduces false alarms. Setup needs a GitHub token, a Telegram bot token, and a chat ID. You can change the repo owner and name, the label list, the lookback window, and the comment threshold. Expect faster triage, fewer missed items, and less time spent checking GitHub. Great for on call alerts, PM watchlists, and QA handoffs.
10 views
view
n8n
IT
Automate Telegram GitHub Version Updates
Keep your n8n Docker server current with a safe, chat based update flow. Teams that run self hosted n8n can use this to check for new releases and upgrade with one tap approval in Telegram. A schedule runs every three days or you can start it by hand. Default variables store your server folder, container name, and Telegram chat id. The flow pulls the latest release tag from GitHub, removes extra text from the tag, and reads the installed version from Docker over SSH. Results are merged and compared. If versions match, a Telegram note confirms no action. If a newer build exists, Telegram asks for approval. On approval, the server pulls the new image, runs docker compose pull and up in the right folder, and then sends a success message in Telegram. You need SSH access to the host, Docker installed, and a Telegram bot with your chat id. Expect checks to run on time and updates to finish in minutes, which saves hands on work and lowers risk. This works well for IT teams, small agencies, and admins who manage one or many n8n instances. Follow the steps below to set credentials, fill the default variables, and test the path end to end.
15 views
view
n8n
IT
Automate GitHub AI Content Generation
Pull AI prompt templates from GitHub, fill in variables, and run them on a local model. Teams use it to keep prompts in one place and get consistent results. Great for content drafts, support replies, and internal notes. You start the run with a manual click. The flow loads a text file from your repo, reads the content, and looks for any placeholder like {{name}}. It checks that all required fields are set and stops with a clear list if something is missing. When everything is present, it replaces the values, sends the final text to an AI Agent that uses Ollama, and captures the answer for you. Variable checks reduce mistakes before the model is called, and repo storage keeps version control in place. Set your repo owner, name, file path, and file name in one place. Connect your GitHub account and an Ollama endpoint, then test. Expect fewer errors, faster drafts, and easier reuse of templates across many teams. This fits teams that treat prompts like code and want consistent, traceable AI output.
11 views
view
See More Templates

These templates were sourced from publicly available materials across the web, including n8n’s official website, YouTube and public GitHub repositories. We have consolidated and categorized them for easy search and filtering, and supplemented them with links to integrations, step-by-step setup instructions, and personalized support in the Futurise community. Content in this library is provided for education, evaluation and internal use. Users are responsible for checking and complying with the license terms with the author of the templates before commercial use or redistribution.Where an original author was identified, attribution has been provided. Some templates did not include author information. If you know who created this template, please let us know so we can add the appropriate credit and reference link. If you are the author and would like this template removed from the library, email us at info@futurise.com and we will remove it promptly.