-
Notifications
You must be signed in to change notification settings - Fork 4.8k
67 lines (60 loc) · 2.66 KB
/
changelog-requirement.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Changelog Requirement
on:
pull_request:
types: [ opened, synchronize, labeled, unlabeled ]
paths:
- 'kong/**'
- '**.rockspec'
- '.requirements'
- 'changelog/**'
jobs:
require-changelog:
if: ${{ !contains(github.event.*.labels.*.name, 'skip-changelog') }}
name: Requires changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Find changelog files
id: changelog-list
uses: tj-actions/changed-files@03334d095e2739fa9ac4034ec16f66d5d01e9eba # 44.5.1
with:
files_yaml: |
changelogs:
- 'changelog/unreleased/**/*.yml'
upper_case:
- 'CHANGELOG/**'
numbered:
- 'changelog/unreleased/**/[0-9]+.yml'
- name: Check changelog existence
if: steps.changelog-list.outputs.changelogs_any_changed == 'false'
run: |
echo "Changelog file expected but found none. If you believe this PR requires no changelog entry, label it with \"skip-changelog\"."
echo "Refer to https://github.com/Kong/gateway-changelog for format guidelines."
exit 1
- name: Check correct case for changelog directory
if: steps.changelog-list.outputs.upper_case_any_changed == 'true'
run: |
echo "Please use \"changelog\" (all lowercase) for changelog modifications."
echo "Refer to https://github.com/Kong/gateway-changelog for format guidelines."
echo "Bad file(s): ${{ steps.changelog-list.outputs.upper_case_all_changed_files }}"
exit 1
- name: Check descriptive filename for changelog entry
if: steps.changelog-list.outputs.numbered_any_changed == 'true'
run: |
echo "Please use short descriptive name for changelog files instead of numbers."
echo "E.g. bump_openresty.yml instead of 12345.yml."
echo "Refer to https://github.com/Kong/gateway-changelog for format guidelines."
echo "Bad file(s): ${{ steps.changelog-list.outputs.numbered_all_changed_files }}"
exit 1
- name: Fail when deprecated YAML keys are used
run: |
for file in ${{ steps.changelog-list.outputs.changelogs_all_changed_files }}; do
if grep -q "prs:" $file || grep -q "jiras:" $file; then
echo "Please do not include \"prs\" or \"jiras\" keys in new changelogs, put the JIRA number inside commit message and PR description instead."
echo "Refer to https://github.com/Kong/gateway-changelog for format guidelines."
echo "Bad file: $file"
exit 1
fi
done