Auto-review GitHub pull requests with n8n

They used an n8n workflow to inspect new GitHub pull requests, generate a review with an LLM, and post feedback back to the PR.

Done with n8nยท Advanced

What they did
A GitHub trigger in n8n started the workflow whenever someone opened a pull request. The flow then pulled the changed files from GitHub, combined each filename with its diff in a Code node, and sent that context to an OpenAI chat model framed as a senior iOS developer. It also used a Google Sheet of Swift style rules as a reference before GitHub nodes added a review comment and a ReviewedByAI label.
How it went
In a test pull request that added iota cryptocurrency support, the agent left one overall comment and added the label. The review was useful as a first pass, but it tended to be wordy and could overlook the main issues.
Tips
Check the output of each node as you assemble the workflow. If you want file-by-file inline remarks, plan for a loop that handles each diff and its line numbers.

Try it yourself with n8n

Set up an n8n workflow for my GitHub repo [owner/repo] that starts when a new pull request is opened. Fetch the changed files and diffs, compare them with these team rules: [paste guidelines], and ask an AI model to review the code for bugs, readability, and missing tests. Draft a single PR comment and suggest a label like [label name]. Before anything is posted, stop and show me the exact comment and label for approval. If I approve, then post the comment and apply the label to the pull request.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on medium.com โ†—

2 more reports of this

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.