-
-
Notifications
You must be signed in to change notification settings - Fork 5
36 lines (34 loc) · 1.04 KB
/
check-changelog.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
name: changelog
on: [label, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
script: |
const labels = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
});
for (const label of labels.data) {
if (label.name === 'no-changelog-required') {
return;
}
}
const files = await github.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
let changeLogPresent = false;
for (const file of files.data) {
if (file.filename === 'CHANGELOG.md') {
changeLogPresent = true;
break;
}
}
if (!changeLogPresent) {
core.setFailed('changelog is required');
}