mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-10 23:01:10 +00:00
Merge pull request #2032 from PR0M3TH3AN/update-automated-pr-review-9225685126346343238
feat: improve automated PR review script reporting
This commit is contained in:
1 file changed
+20
@@ -129,6 +129,10 @@ async function reviewPR(prNumber, baseRef) {
|
||||
hasFailures = true;
|
||||
commentBody += '### ⚠️ Lint Warnings/Errors\n\n';
|
||||
commentBody += '```\n' + lintRes.stdout + '\n' + lintRes.stderr + '\n```\n\n';
|
||||
|
||||
if (lintRes.stdout.includes('stylelint') || lintRes.stderr.includes('stylelint')) {
|
||||
commentBody += '> **💡 Tip:** Try running `npm run lint:css -- --fix` to automatically resolve some style issues.\n\n';
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Unit Tests
|
||||
@@ -138,6 +142,19 @@ async function reviewPR(prNumber, baseRef) {
|
||||
hasFailures = true;
|
||||
commentBody += '### ❌ Test Failures\n\n';
|
||||
commentBody += '```\n' + testRes.stdout + '\n' + testRes.stderr + '\n```\n\n';
|
||||
|
||||
// Extract failing test files
|
||||
const failingTests = [];
|
||||
const failureRegex = /✖\s+(tests\/[\w\-\.\/]+)\s+failed with exit code 1/g;
|
||||
const testOutput = testRes.stdout + '\n' + testRes.stderr;
|
||||
let match;
|
||||
while ((match = failureRegex.exec(testOutput)) !== null) {
|
||||
failingTests.push(match[1]);
|
||||
}
|
||||
|
||||
if (failingTests.length > 0) {
|
||||
commentBody += `> **Suggested areas to inspect:** ${failingTests.map(f => `\`${f}\``).join(', ')}\n`;
|
||||
}
|
||||
commentBody += '> **Suggestion:** Inspect the stack trace above. Run `npm run test:unit` locally to reproduce.\n\n';
|
||||
} else {
|
||||
commentBody += '### ✅ Tests Passed\n\nAll unit tests passed.\n\n';
|
||||
@@ -159,7 +176,10 @@ async function reviewPR(prNumber, baseRef) {
|
||||
if (sensitiveChanges.length > 0) {
|
||||
commentBody += '### 🛡️ Guardrails\n\n';
|
||||
commentBody += 'This PR modifies sensitive files. **Security and Protocol Review Required.**\n';
|
||||
|
||||
// Explicit flags for CI/bots to pick up
|
||||
commentBody += '`requires-security-review` `requires-protocol-review`\n\n';
|
||||
|
||||
commentBody += '<details><summary>Sensitive Files Touched</summary>\n\n';
|
||||
sensitiveChanges.forEach(f => commentBody += `- ${f}\n`);
|
||||
commentBody += '\n</details>\n\n';
|
||||
|
||||
Reference in new issue
Block a user