00:00:00So recently I came across a tool called CodeRabbit which is basically an AI-powered code review
00:00:05assistant that integrates with platforms like GitHub and provides line-by-line feedback on
00:00:10pull requests. The idea is pretty simple but extremely powerful. Whenever you open a pull request,
00:00:16an AI automatically reviews your code and leaves comments suggesting improvements, pointing out bugs
00:00:22and highlighting potential issues. But just like most AI tools today, the free version is quite
00:00:28limited and the full functionality requires a paid subscription. So I did what most developers
00:00:33would do when they see a cool product. I tried building it myself. But this time, instead of
00:00:38writing hundreds of lines of code, we are going to build this entire system using NA10 which is
00:00:44a powerful workflow automation platform. So let's get started. We first need to set up NA10. You
00:00:51basically have two options. The first option is running it locally on your computer using a simple
00:00:56command which is great if you just want to experiment with it or quickly test some workflows.
00:01:01However, if you want your automation to actually run in the background and be available 24/7,
00:01:06then you will eventually need to host it somewhere. You can host it using NA10 Cloud which is the
00:01:12official managed hosting platform. But personally, I found it a little expensive since the pricing
00:01:17starts around $20 per month and it can increase depending on how much automation you use.
00:01:23On top of that, setting up NA10 from scratch on a server can sometimes be a bit complex if you're
00:01:28not familiar with server configuration. So if you want something that is cheaper and much easier to
00:01:33set up, you can use Hostinger which is also the sponsor of today's video. So what you need to do
00:01:39is click the first link in the description which will take you directly to Hostinger's NA10 self
00:01:44hosting page. If you scroll down to the pricing section, you will see that the plans are actually
00:01:50very affordable compared to NA10 Cloud. But pricing is not the only advantage here. When you
00:01:56self host NA10 on a VPS from Hostinger, you get unlimited workflows, full ownership over your data,
00:02:03and predictable pricing because you are not paying based on usage. Another big advantage is that
00:02:08Hostinger provides a one-click setup so you can get your NA10 instance running in just a few minutes
00:02:14without dealing with complicated installation steps. For this tutorial, I recommend choosing the KVM2
00:02:20plan which is the most popular option and provides enough resources to comfortably run multiple
00:02:25workflows. Once you select the plan, you will be taken to the checkout page where you can choose
00:02:31the billing period. Usually selecting 12 or 24 months gives you the best value. If you scroll down
00:02:37further, you will be able to choose the server region and in the operating system section you
00:02:42will notice that NA10 is already pre-selected. And by the way, if you want an additional discount,
00:02:48you can use my coupon code DECODINGCOALATEN to get an extra 10% off. After that, you simply
00:02:54create an account if you do not already have one, enter your payment information, and complete the
00:02:58checkout. Once your payment is complete, you will be redirected to the VPS setup page where you need
00:03:04to enter a root password for your server. After a few moments, your VPS will be ready and you should
00:03:10see it appear inside your hosting a dashboard. And that is basically it. Now we can finally focus on
00:03:16the interesting part, building our workflow. Once your VPS is ready, simply click Manage App,
00:03:22create your NA10 account if you do not already have one, and you should be taken to the dashboard.
00:03:27Inside the dashboard, you generally have two options when creating workflows. You can either
00:03:33start completely from scratch or you can use an existing template that someone else has already
00:03:38created. In fact, for this AI GitHub code review, we will also start from an existing template and
00:03:44then customize it according to our needs. So let's go ahead and import the template. You can either
00:03:50import it directly into your instance or copy the template to your clipboard and paste it into your
00:03:55workflow editor. I will go with the clipboard option. Now we can start working on our workflow.
00:04:01Let's start with the first node. The first node is the GitHub trigger, which basically listens for
00:04:06events happening in your GitHub repository. To configure it, simply double click the node and
00:04:11create new credentials. You will see two options for connecting your GitHub account. I will use the
00:04:17OAuth2 option. To get the required credentials, go to your GitHub settings, scroll down to developer
00:04:23settings, open OAuth apps, and create a new OAuth application. Give it a name. And for the callback
00:04:30URL, you simply copy the redirect URL provided by n8n and paste it there. After registering the
00:04:36application, GitHub will generate a client ID and you can also create a client secret. Copy both of
00:04:42these values and paste them into the credential fields inside n8n. Then click connect and authorize
00:04:48the application. Once connected, you simply enter the repository owner and repository name and make
00:04:54sure the event type is set to pull request. Now the workflow will automatically listen for pull requests
00:05:00created in that repository. The next node in our workflow is responsible for retrieving the file
00:05:06differences from the pull request. Whenever a pull request is created, there are changes between the
00:05:11old code and the new code and this node fetches those changes so that our AI can analyze them.
00:05:17After that, we have a JavaScript node called create target prompt. This node prepares the prompt that
00:05:23will be sent to the AI model. Inside the code, you will see a variable called user message, which
00:05:29contains the instructions for the AI. The nice thing is that you can customize this prompt however you
00:05:34want, depending on how strict or detailed you want the code review to be. Next comes the code review
00:05:40agent node, which is responsible for actually sending the request to the AI model. The template
00:05:45originally connects to an OpenAI model and also uses Google Sheets for coding guidelines.
00:05:51But for this tutorial, we will use the Google Gemini model so we can remove the Google Sheets node and
00:05:57replace the OpenAI model with a Gemini chat model. All you need to do is paste your Gemini API key
00:06:04and now Gemini will handle the code review. At this point, our workflow already does most of the
00:06:10heavy lifting. It listens for pull requests, retrieves the changed code, creates a prompt,
00:06:16and sends it to the AI for analysis. Now we just need to post the results back to GitHub. The next
00:06:22node is called GitHub robot and this node is responsible for posting comments directly on
00:06:27the pull request. Once again, we use the GitHub credentials we configured earlier, enter the
00:06:32repository details, and select the comment event type. Finally, we have one last GitHub node that
00:06:39adds a label to identify that the comment was generated by our AI review. Double-click on it
00:06:44and fill in the same info as before. And you can also edit the label as you wish. And that is it.
00:06:50Our workflow is now complete. Before we test, let's first publish our workflow. Just click publish at
00:06:56the top, give it a name, and that's it. Now let's test it. I'm using a repository called Quizify,
00:07:03which is basically an AI quiz generator project. To test our workflow, I will intentionally add some
00:07:09bad code so that the AI has something to criticize. Before pushing the changes, make sure you create a
00:07:16separate branch so that you can open a pull request. Once the branch is pushed, we create the pull
00:07:21request. Now if everything is configured correctly, our workflow should trigger automatically. And as
00:07:30you can see, the AI has already analyzed the code and started leaving comments directly on the pull
00:07:36request. Every time you open a new PR in the future, this workflow will automatically run and review
00:07:43your code. You can also check the execution logs inside N8N to see that the workflow ran successfully.
00:07:49So yeah, that is basically how you can build your own AI GitHub code reviewer using N8N,
00:07:55hosted on Hostinger and automate code reviews in just a few minutes. And the cool part is that this
00:08:00is only scratching the surface of what you can build with N8N. Once you start experimenting with it, you
00:08:06can automate everything from deployment pipelines to AI agents and productivity workflows. So that
00:08:12was it for this video. Thanks to Hostinger for sponsoring this video and make sure you guys check
00:08:17it out. If you found this video helpful, make sure to like, share, and subscribe. And I'll see you guys
00:08:23in the next one.