@@ -25,17 +25,19 @@ jobs:
2525 const match = body.match(/### Debug logs\s*\n([\s\S]*?)(?=\n### |$)/);
2626 const logsSection = match ? match[1].trim() : '';
2727
28- // Patterns that indicate real debug logs
28+ // Must contain at least one DEBUG-level line.
29+ // WARNING/INFO-only logs are not debug logs.
30+ const hasDebugLevel = /\bDEBUG\b/.test(logsSection);
31+
32+ // Additional quality patterns
2933 const logPatterns = [
3034 /\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}/, // timestamp
31- /\b(DEBUG|INFO|WARNING|ERROR|CRITICAL)\b/, // log level
3235 /custom_components\.cardata/, // integration logger
33- /\(MainThread\)/, // HA thread marker
3436 ];
3537
3638 const hasLabel = context.payload.issue.labels.some(l => l.name === 'needs-debug-logs');
3739 const matchCount = logPatterns.filter(p => p.test(logsSection)).length;
38- const isValid = logsSection.length > 100 && matchCount >= 2 ;
40+ const isValid = logsSection.length > 100 && hasDebugLevel && matchCount >= 1 ;
3941
4042 if (!isValid) {
4143 // Add label if not present
@@ -110,16 +112,15 @@ jobs:
110112 const logAttachmentPattern = /github\.com\/user-attachments\/files\/\d+\/[^\s)]+\.log\b/i;
111113 const logPatterns = [
112114 /\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}/, // timestamp
113- /\b(DEBUG|INFO|WARNING|ERROR|CRITICAL)\b/, // log level
114115 /custom_components\.cardata/, // integration logger
115- /\(MainThread\)/, // HA thread marker
116116 ];
117117
118118 const hasLogs = comments.some(c => {
119119 const body = c.body || '';
120120 if (logAttachmentPattern.test(body)) return true;
121+ const hasDebugLevel = /\bDEBUG\b/.test(body);
121122 const matchCount = logPatterns.filter(p => p.test(body)).length;
122- return body.length > 100 && matchCount >= 2 ;
123+ return body.length > 100 && hasDebugLevel && matchCount >= 1 ;
123124 });
124125
125126 if (hasLogs) {
0 commit comments