-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
40 lines (36 loc) · 1.22 KB
/
action.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
name: 'Changelog entry included'
description: 'Verify if the PR includes a new changelog entry'
runs:
using: "composite"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 2
- name: Check changelog file added
run: git diff --name-only --diff-filter=A HEAD^ HEAD | grep 'releases/unreleased'
shell: bash
- name: Set up Python 3
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
- name: Install pyyaml to validate file
run: pip install pyyaml
shell: bash
- name: Validate the new changelog files (yaml format)
run: |
filenames=$(git diff --name-only --diff-filter=A HEAD^ HEAD | grep 'releases/unreleased')
echo "$filenames" | while read filename;
do
echo -n "$filename: "
if ! [ -s $filename ]; then
echo "Empty changelog file"
exit 1
fi
python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < $filename
if [ $? != 0 ]; then
echo "Invalid yaml format"
exit 1
fi
echo "OK"
done
shell: bash