-
Notifications
You must be signed in to change notification settings - Fork 988
45 lines (42 loc) · 1.83 KB
/
changelog-verification.yml
File metadata and controls
45 lines (42 loc) · 1.83 KB
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
name: Changelog verification
permissions:
contents: read
pull-requests: read
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches:
- master
jobs:
changelog-verification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for changelog entry
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-not-required') }}
run: |
git fetch origin ${{ github.base_ref }} --depth 1
NON_TEST_FILES=$(git diff remotes/origin/${{ github.base_ref }} --name-only | grep "\.java$" | grep -v -E "(^|/)(test|it)/" || true)
if [ -n "$NON_TEST_FILES" ]; then
echo "::notice::Non-test Java changes found:"
echo "$NON_TEST_FILES" | while read file; do
echo "::notice::$file"
done
echo "Checking for changelog entry..."
CHANGELOG_FILES=$(git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/next-release/.*[a-zA-Z0-9_-]+\.json" || true)
if [ -z "$CHANGELOG_FILES" ]; then
echo "::error::No changelog entry found for Java changes"
exit 1
else
echo "::notice::Changelog entry found: $CHANGELOG_FILES"
fi
else
echo "::notice::No non-test Java changes found. Changelog verification skipped."
fi
- name: Error message
if: ${{ failure() }}
run: |
echo "::error::No new/updated changelog entry found in /.changes/next-release directory. Please either:"
echo "::error::* Add a changelog entry (see CONTRIBUTING.md for instructions) –or–"
echo "::error::* Add the 'changelog-not-required' label to this PR (in rare cases not warranting a changelog entry)"
exit 1