Skip to content

Commit 73ada51

Browse files
committed
Revert "Fix: Detect issue type from body content pattern since GitHub webhook doesn't include type field"
This reverts commit 6690482.
1 parent 6690482 commit 73ada51

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

.github/workflows/issue-comment.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)