forked from AynOps/AynOps
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 2.08 KB
/
Copy pathlabeler.yml
File metadata and controls
48 lines (42 loc) · 2.08 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
name: Issue Labeler
on:
issues:
types: [opened, edited]
jobs:
label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v8
with:
script: |
// Single source of truth for keyword -> label matching.
// Only labels here are ones a title can reliably signal.
// Excluded on purpose (see PR description for why):
// dependencies, dockerfile, python:uv -> Dependabot-owned, PR-only scope
// duplicate, invalid, wontfix, help wanted -> maintainer triage judgment, not title-derivable
// size: small/medium/large -> handled by pr-size-labeler.yml
// Stale -> handled by a time-based stale workflow
// To add a new label: add one entry below, nothing else to touch.
const LABEL_KEYWORDS = {
"bug": ["bug", "error", "crash", "broken", "fails", "failing", "not working"],
"enhancement": ["feature", "enhancement", "improve", "improvement", "request"],
"good first issue": ["good first issue", "beginner", "easy", "starter"],
"documentation": ["docs", "documentation", "readme", "typo", "wiki"],
"question": ["question", "how to", "help", "unclear", "clarification"],
"cleanup": ["cleanup", "clean up", "refactor", "restructure", "rewrite", "tech debt", "remove unused", "dead code"],
"reliability": ["reliability", "flaky", "intermittent", "race condition", "retry", "resiliency"],
};
const title = context.payload.issue.title.toLowerCase();
const labels = Object.entries(LABEL_KEYWORDS)
.filter(([, keywords]) => keywords.some((keyword) => title.includes(keyword)))
.map(([label]) => label);
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels,
});
}