-
Notifications
You must be signed in to change notification settings - Fork 5.5k
62 lines (56 loc) · 2.05 KB
/
auto-label.yml
File metadata and controls
62 lines (56 loc) · 2.05 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
name: Auto Label
on:
pull_request_target:
types: [opened, synchronize]
issues:
types: [opened, edited]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
label-pr:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-24.04
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pr-number: "${{ github.event.pull_request.number }}"
label-issue:
if: github.event_name == 'issues'
runs-on: ubuntu-24.04
steps:
- uses: actions/github-script@v7
with:
script: |
const title = context.payload.issue.title.toLowerCase();
const body = (context.payload.issue.body || '').toLowerCase();
const text = title + ' ' + body;
const labels = [];
if (text.includes('crash') || text.includes('error') || text.includes('bug') || text.includes('broken') || text.includes('regression')) {
labels.push('bug');
}
if (text.includes('security') || text.includes('vulnerability') || text.includes('cve') || text.includes('injection')) {
labels.push('security');
}
if (text.includes('performance') || text.includes('slow') || text.includes('memory leak') || text.includes('latency')) {
labels.push('performance');
}
if (text.includes('telegram') || text.includes('discord') || text.includes('connector')) {
labels.push('connector');
}
if (text.includes('memory') || text.includes('context') || text.includes('rag')) {
labels.push('memory');
}
if (text.includes('plugin')) {
labels.push('plugin');
}
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labels
});
}