-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (35 loc) · 1.03 KB
/
pr-label.yml
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
name: Verify PR labels
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
permissions:
contents: read
jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- name: Check labels
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
const expectedLabels = [
'breaking',
'major',
'feature',
'enhancement',
'fix',
'bugfix',
'bug',
'chore',
'dependencies',
'security',
'minor',
'patch',
'ci'
];
const missingLabels = expectedLabels.filter(label => !labels.includes(label));
if (missingLabels.length == expectedLabels.length) {
core.setFailed(`Missing labels: ${missingLabels.join(', ')}`);
}