forked from komalharshita/DevPath
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (59 loc) · 1.75 KB
/
auto-label-prs.yml
File metadata and controls
76 lines (59 loc) · 1.75 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
name: Auto Label Pull Requests
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
permissions:
pull-requests: write
issues: write
jobs:
auto-label-prs:
runs-on: ubuntu-latest
steps:
- name: Apply PR labels
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const branch = pr.head.ref;
let labels = ['gssoc-2026'];
// Difficulty labels
if (branch.startsWith('level1/')) {
labels.push('level:beginner');
}
if (branch.startsWith('level2/')) {
labels.push('level:intermediate');
}
if (branch.startsWith('level3/')) {
labels.push('level:advanced');
}
if (branch.startsWith('level4/')) {
labels.push('level:critical');
}
// Type labels
if (branch.includes('feat/')) {
labels.push('type:feature');
}
if (branch.includes('fix/')) {
labels.push('type:bug');
}
if (branch.includes('docs/')) {
labels.push('type:docs');
}
if (branch.includes('refactor/')) {
labels.push('type:refactor');
}
if (branch.includes('test/')) {
labels.push('type:testing');
}
if (branch.includes('style/')) {
labels.push('type:design');
}
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels
});