generated from iadvize/hello-world-javascript-library
-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (34 loc) · 1.17 KB
/
pull-labels.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
39
40
41
42
name: Pull request labels
on:
pull_request:
types: [labeled, unlabeled, synchronize]
jobs:
version-labels:
name: 'check version label'
runs-on: ubuntu-18.04
steps:
- name: Check if version label is present
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const versionLabels = [
'Action: no bump',
'Action: beta bump',
'Action: patch bump',
'Action: minor bump',
'Action: major bump',
];
const { data: labels } = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
per_page: 100,
});
const versionLabelsPresent = labels
.filter(label => versionLabels.includes(label.name))
if (versionLabelsPresent.length === 1) {
return;
}
console.log(`::debug ::${versionLabelsPresent.length} matching labels`);
throw new Error(`Should have one and only one of ${versionLabels.join(', ')} labels`);