Use this powerful n8n workflow to automatically lint, fix, and create new Pull Requests on GitHub using a Google Gemini AI Agent. Leverage n8n templates for streamlined DevOps automation.
Download this n8n workflow template and start using it instantly.
Markdown-formatted:
DevOps Engineers looking to automate code quality checks.
Software development teams seeking to enforce coding standards automatically.
Users of n8n who want complex, multi-step AI agents for infrastructure tasks.
Anyone interested in using n8n templates for advanced GitHub integration.
Maintaining code quality across a large team can be challenging. This advanced n8n workflow solves this by providing a hands-free, automated linting bot. The system is designed to trigger automatically upon GitHub Pull Request activity. It uses an AI Agent powered by Google Gemini to analyze, interpret, and fix code based on defined standards. After fixing the code, the n8n workflow leverages a series of HTTP Request Tool nodes to perform sophisticated Git operations—creating blobs, trees, and commits—before ultimately opening a new pull request containing the linting fixes. This specific n8n workflow drastically reduces the time spent on manual code reviews and ensures immediate compliance with code standards, making it one of the most valuable n8n templates for modern software development practices.
The automated process initiates with the Listen for Trigger from Github Workflow n8n trigger, an incoming webhook that captures PR details.
Set Common Fields) to define necessary repository variables. It then retrieves core GitHub data, including the latest SHA and Tree Hash of the main branch, and the details of the triggered PR.Get PR Files). It then enters a loop: for each file, it fetches the Base64 content, decodes it into readable text (Convert Base64 to Text File and Extract from File), and structures it into a uniform object (Create Code/FilePath Object).Collect All Files Changed n8n node. This aggregated data, containing the code needing review, is fed into the AI Agent n8n node, which utilizes the Google Gemini Chat Model.httpRequestTool nodes) that allow it to perform actions based on its findings. It checks for a pre-existing linting fix branch (Get Branch), and if necessary, creates a new one (Create Branch). It then uses the fixes generated by the AI to create new GitHub blobs (Create GitHub Blob), construct a new commit tree (Create GitHub Tree), and finally, execute the commit (Create GitHub Commit).Create Pull Request n8n node tool to open a new PR containing all the AI-applied fixes, before the n8n workflow concludes by acknowledging the initial webhook.Markdown-formatted:
Google Gemini Chat Model n8n node.Set Common Fields Code n8n node to correctly define your gitHubRepoName and gitHubOrgName.Listen for Trigger from Github Workflow n8n trigger node. Configure your GitHub repository webhooks or GitHub Action to send PR events (e.g., pull_request types) to this specific URL path.Markdown-formatted:
Listen for Trigger from Github Workflow (Webhook n8n trigger):
Function: Serves as the starting n8n trigger for the entire automation, listening for incoming HTTP requests (specifically GitHub webhook events related to PRs).
Key Configuration: Configured with a unique webhook path to receive the GitHub payload.
Set Common Fields (Code n8n node):
Function: Centralized configuration point to define repository name, organization, and calculate the GitHub API base URI, which is used by subsequent HTTP Request n8n nodes.
Get PR Files & Get File Contents (HTTP Request n8n node):
Function: Handles communication with the GitHub API to fetch the list of files in the PR and then retrieves the content of each individual file.
Convert Base64 to Text File & Extract from File (Converter n8n nodes):
Function: Decodes the file content retrieved from GitHub (which is usually Base64 encoded) so that the raw code can be processed by the AI Agent n8n node.
Google Gemini Chat Model (Language Model n8n node):
Function: Provides the large language model capability (Gemini 2.0 Flash) to the AI Agent for complex reasoning and code manipulation tasks.
AI Agent (Langchain Agent n8n node):
Function: The intelligence core of this n8n workflow. It takes the aggregated code files and, using its configured system prompt, determines the necessary linting fixes and executes appropriate actions via its linked tools.
Create GitHub Blob/Tree/Commit/Branch/Pull Request (HTTP Request Tool n8n nodes):
* Function: These are specialized n8n node tools utilized by the AI Agent. They encapsulate complex, authenticated HTTP POST operations required to manipulate the Git repository structure (e.g., creating a new commit object or defining a new branch reference).
Automate GitHub issue assignment triage using comment commands like 'assign me'. This n8n workflow utilizes conditional logic and a GitHub n8n trigger to manage assignments efficiently.

Use this comprehensive n8n workflow to automate the entire OpenAI GPT fine-tuning process. Pull data from Google Sheets, convert to JSONL, initiate the job, and track status automatically.

Automate GDPR compliance using a powerful n8n workflow. Capture consent via a webhook, store records in Google Sheets, and generate personalized HTML confirmation emails using Azure OpenAI.

Use this powerful n8n workflow to automatically create GitHub Pull Requests and update JIRA task statuses directly from specified commands embedded within your Git commit messages.








































