@@ -45,23 +45,16 @@ jobs:
4545 const issue = context.payload.issue || {};
4646
4747 // Log the full issue payload for debugging
48- console.log('Issue payload keys :', Object.keys (issue));
49- console.log('Issue body :', issue.body );
48+ console.log('Issue payload:', JSON.stringify (issue, null, 2 ));
49+ console.log('Issue type field :', issue.type );
5050 console.log('Issue labels:', issue.labels);
5151
52- // GitHub doesn't send 'type' in webhook payload, but we can detect from template used
53- // The template name is NOT directly available, so detect by checking issue body prefix or labels
54- const body = (issue.body || '').toLowerCase();
52+ // Detect issue type - try multiple possible sources
53+ const issueType = (issue.type || '').toLowerCase();
5554 const labels = (issue.labels || []).map(l => (l.name || l).toLowerCase());
5655
57- // Detect based on: body content pattern, labels, or title prefix
58- const isBug = body.includes('describe the issue') ||
59- labels.some(l => l.includes('bug')) ||
60- labels.some(l => l.includes('type:bug'));
61-
62- const isQuestion = body.includes('how can we help') ||
63- labels.some(l => l.includes('question')) ||
64- labels.some(l => l.includes('type:question'));
56+ const isBug = issueType === 'bug' || issueType === 'bug_report' || labels.includes('bug') || labels.includes('type:bug');
57+ const isQuestion = issueType === 'question' || labels.includes('question') || labels.includes('type:question');
6558
6659 // Choose template based on type detection; fall back to genericComment if no match
6760 let comment = '';
0 commit comments