-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (82 loc) · 3.91 KB
/
issue-labeler.yml
File metadata and controls
102 lines (82 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: 🏷️ Issue Labeler
on:
issues:
types: [opened, edited]
jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Auto-label Issues
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue;
const title = issue.title.toLowerCase();
const body = issue.body.toLowerCase();
const labels = [];
// Determine issue type based on title and body
if (title.includes('[bug]') || title.includes('bug') || body.includes('error') || body.includes('compilation')) {
labels.push('bug');
}
if (title.includes('[feature]') || title.includes('feature') || body.includes('new') || body.includes('add')) {
labels.push('enhancement');
}
if (title.includes('[content]') || title.includes('content') || body.includes('improve') || body.includes('better')) {
labels.push('content');
}
if (title.includes('[question]') || title.includes('question') || body.includes('how') || body.includes('what') || body.includes('why')) {
labels.push('question');
}
// Add learning level labels
if (body.includes('beginner') || body.includes('new to java') || body.includes('first time')) {
labels.push('beginner-friendly');
}
if (body.includes('advanced') || body.includes('expert') || body.includes('complex')) {
labels.push('advanced');
}
// Add topic-specific labels
if (body.includes('day 1') || body.includes('day 2') || body.includes('day 3') || body.includes('basics')) {
labels.push('java-basics');
}
if (body.includes('oop') || body.includes('class') || body.includes('object') || body.includes('inheritance')) {
labels.push('object-oriented');
}
if (body.includes('collection') || body.includes('arraylist') || body.includes('hashmap')) {
labels.push('collections');
}
if (body.includes('thread') || body.includes('concurrency') || body.includes('multithreading')) {
labels.push('concurrency');
}
if (body.includes('stream') || body.includes('lambda') || body.includes('functional')) {
labels.push('modern-java');
}
if (body.includes('database') || body.includes('jdbc') || body.includes('sql')) {
labels.push('database');
}
if (body.includes('web') || body.includes('servlet') || body.includes('jsp') || body.includes('rest')) {
labels.push('web-development');
}
// Add priority labels
if (body.includes('urgent') || body.includes('critical') || body.includes('blocking')) {
labels.push('high-priority');
}
if (body.includes('nice to have') || body.includes('future') || body.includes('suggestion')) {
labels.push('low-priority');
}
// Add help wanted for questions
if (labels.includes('question')) {
labels.push('help-wanted');
}
// Add needs-triage if no specific type identified
if (labels.length === 0) {
labels.push('needs-triage');
}
// Add the labels
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: labels
});
}