-
Notifications
You must be signed in to change notification settings - Fork 57
42 lines (40 loc) · 1.13 KB
/
pr_label.yaml
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
name: PR / Label
on:
pull_request_target: { }
jobs:
triage:
name: Triage
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Apply context labels
uses: actions/labeler@v5
with:
configuration-path: .github/labeler.yaml
sync-labels: true
- name: Apply commit message labels
uses: actions/github-script@v7
with:
script: |
const labels = []
if (context.payload.pull_request.title.startsWith('fix:')) {
labels.push('bug 🐛')
}
if (context.payload.pull_request.title.startsWith('chore:')) {
labels.push('chore 🧹')
}
if (context.payload.pull_request.title.startsWith('feat:')) {
labels.push('feature 💡')
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
labels,
owner: context.repo.owner,
repo: context.repo.repo,
})
}