n8n Integration (PR Webhook Automation)¶
This repository includes a GitHub-native PR quality workflow (pr-quality-comment.yml) that
runs quality.sh cov on PR open/update and posts a PR comment.
If you want an n8n production vibe, connect GitHub webhooks to n8n and mirror the same flow:
- GitHub webhook (
pull_requestevents) β n8n Webhook node. - n8n triggers a runner/container job that executes:
python -m pip install -U pippython -m pip install -r requirements-test.txt -r requirements-docs.txt -e .bash quality.sh cov- n8n posts the result back using GitHub API:
- commit status/check run
- PR comment summary
Minimal payload strategy¶
Use PR number, repo owner/name, head SHA, and workflow URL in your status/comment payload.
Suggested comment template¶
### SDET Quality Gate
- result: PASS/FAIL
- command: `bash quality.sh cov`
- details: <link to logs>
This keeps signal high and matches the same quick-feedback style as sdetkit doctor --pr.
Recommended alignment: GitHub Actions + n8n (hybrid model)¶
If your goal is to make automation "work better together", the most reliable pattern is:
- Keep required quality/security gates in GitHub Actions (deterministic, branch-protected).
- Use n8n for orchestration and notifications (cross-system glue, ticketing, chat, approvals).
What should run where¶
| Capability | GitHub Actions | n8n |
|---|---|---|
PR test/quality gate (quality.sh cov) |
β required check | optional mirror/comment |
Repository audit (sdetkit repo audit) |
β required or nightly | trigger remediation workflow |
| Release/tag flow | β source of truth | notify changelog + downstream systems |
| External approvals (Jira/ServiceNow/Slack) | limited | β best place |
| Multi-repo portfolio dashboarding | basic artifacts | β aggregate and route |
This split avoids drift while still giving you flexible enterprise automation.
Additional workflows worth enabling¶
If you want stronger alignment, these are usually the highest ROI additions:
workflow_runbridge- Trigger n8n only after
ci.yml/quality.ymlsucceeds. - Prevents noisy automations on failing commits.
- Nightly audit + drift digest
- Keep
repo-audit.ymlscheduled. - Send a single daily n8n summary to Slack/Teams instead of per-PR spam.
- Auto-remediation proposal path
- On audit/security warnings, call
sdetkit repo pr-fixin controlled mode. - n8n can enrich with ticket metadata before opening/labeling PRs.
- Manual approval gate for production-impacting actions
- Use GitHub Environments for deploy constraints.
- Use n8n for business approvers and evidence trail.
n8n workflow blueprint (practical)¶
- Webhook (GitHub events)
- Filter node (
pull_request+ branch policy) - Execute Command / CI runner trigger (
bash quality.sh covand optionalsdetkit repo check --format json) - Function node normalize to
{status, pr, sha, findings, url} - GitHub node post check status + concise PR comment
- ChatOps node (Slack/Teams) only on fail/warn
Design tip: keep one canonical JSON shape across all n8n branches so adding new automations stays low-friction.
Example: gate on repository audit JSON¶
- Add an Execute Command node:
sdetkit repo check --format json --out report.json --force
- Add a Read Binary/File node to load
report.json. - Add a Function node:
const report = JSON.parse($json.data);
if (!report.summary.ok) {
throw new Error(`Repo findings: ${report.summary.findings}`);
}
return [{ json: report.summary }];
This gives CI/n8n-friendly deterministic machine output.
Production-readiness baseline (recommended)¶
Use this as a minimum gate before enabling broad automations:
- Dependency bootstrap is explicit and repeatable:
python -m pip install -U pipbash scripts/bootstrap.sh . .venv/bin/activate- Core validation passes cleanly:
pytest -qbash quality.sh cov- PR automation posts only on deterministic states:
- PASS: short success note + links
- FAIL: concise failure summary + first actionable fix
- Remediation automations are opt-in and traceable:
- open PRs with labels + audit trail
- never push directly to protected branches
This keeps the repository CI-ready and avoids production drift between local checks, GitHub Actions, and n8n orchestration.