-
Notifications
You must be signed in to change notification settings - Fork 24
40 lines (36 loc) · 1.18 KB
/
require-label.yml
File metadata and controls
40 lines (36 loc) · 1.18 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
name: Require Label
on:
pull_request:
types: [ opened, edited, labeled, unlabeled, synchronize ]
jobs:
check-label:
runs-on: ubuntu-slim
steps:
- name: Check for Label
uses: actions/github-script@v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const requiredLabels = [
'feature-cli',
'feature-figma-plugin',
'feature-gradle-plugin',
'feature-intellij-plugin',
'feature-sdk',
'bugfix-cli',
'bugfix-figma-plugin',
'bugfix-gradle-plugin',
'bugfix-intellij-plugin',
'bugfix-sdk',
'housekeeping',
'dependencies',
'changelog'
];
const labels = context.payload.pull_request.labels.map(label => label.name);
const hasRequiredLabel = labels.some(label => requiredLabels.includes(label));
if (!hasRequiredLabel) {
core.setFailed(
`Pull request must have at least one of the following labels: ` +
`${requiredLabels.join(', ')}`
);
}