forked from data-govt-nz/ckanext-security
-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (39 loc) · 1.35 KB
/
change_log.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
43
name: Changelog Entry
on: [pull_request]
permissions:
contents: read
jobs:
check_file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Chanelog Exists
run: |
if [[ $(ls ./changes/${{ github.event.number }}.*) ]]; then
echo -e "\n"
echo -e "\033[0;36mINFO: changelog for PR ${{ github.event.number }} exists.\033[0;0m"
echo -e "\n"
exit 0
else
echo -e "\n"
echo -e "\033[0;31mERROR: changelog for PR ${{ github.event.number }} does not exist.\033[0;0m"
echo -e "\n"
exit 1
fi
- name: Check Changelog Extension
run: |
fullfile=$(ls ./changes/${{ github.event.number }}.*)
filename=$(basename -- "$fullfile")
extension="${filename##*.}"
allowed_types='[ "fix", "bugfix", "hotfix", "feature", "misc", "changes", "migration", "removal" ]'
if [[ $allowed_types =~ "\"$extension\"" ]]; then
echo -e "\n"
echo -e "\033[0;36mINFO: extension ${extension} accepted.\033[0;0m"
echo -e "\n"
exit 0
else
echo -e "\n"
echo -e "\033[0;31mERROR: changelog file ending in ${extension} not supported.\033[0;0m"
echo -e "\n"
exit 1
fi