π Review GitHub PR security with DeepSeek and Gmail alerts
β‘ 46 views Β· π SecOps & Security Automation
π‘ Pro Tip β If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.
Description
Quick overview
Most teams donβt have a security reviewer on every PR. This workflow gives you one: it reads the diff, catches hardcoded secrets and risky code, posts a real GitHub status check, comments inline on the exact flagged line, and emails the verdict.
How it works
- Triggers when a pull request is opened or synchronized (updated) in a GitHub repository.
- Fetches the pull requestβs unified diff from GitHub and truncates it to fit the model context while adding PR metadata (title, author, repository).
- Sends the formatted diff to DeepSeek via a LangChain agent and enforces a strict JSON output containing a verdict, issue list (with file and line), and summary.
- Posts a GitHub commit status to the PRβs head SHA using the
ai-pr-reviewercontext, marking pass as success and all other verdicts as failure. - Adds a summary comment to the pull request with the verdict, findings, and a count of issues.
- If issues are present, converts the reported file/line hints into GitHub diff positions and posts inline review comments on the flagged lines.
- Routes by verdict (blocked, needs_changes, pass) and sends a corresponding Gmail notification with the summary and issues.
Setup
- Add a GitHub API credential with access to pull requests, commit statuses, and the ability to create PR comments (and configure the workflowβs owner/repository values if youβre not using the included repo).
- Add a DeepSeek API credential (or replace the model node with your preferred compatible chat model) and keep the structured output schema aligned with the agent prompt.
- Add Gmail OAuth2 credentials and update the recipient email address and subject/message templates as needed.
- (Optional) Enable GitHub branch protection rules to require the
ai-pr-reviewerstatus check context to enforce the verdict as a merge gate.
π Nodes Used
GitHub, Github Trigger, HTTP Request, Gmail, AI Agent, Structured Output Parser
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File