Skip to content

Commit 352da8d

Browse files
committed
Update changelog-verification.yml to only trigger java change
1 parent 95b9fa2 commit 352da8d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/changelog-verification.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
types: [ opened, synchronize, reopened, labeled, unlabeled ]
1010
branches:
1111
- master
12+
paths:
13+
- '**/*.java'
1214

1315
jobs:
1416
changelog-verification:
@@ -18,12 +20,21 @@ jobs:
1820
- name: Check for changelog entry
1921
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-not-required') }}
2022
run: |
21-
git fetch origin ${{ github.base_ref }} --depth 1 && \
22-
git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/next-release/*[a-zA-Z0-9_-]+\.json"
23+
git fetch origin ${{ github.base_ref }} --depth 1
24+
NON_TEST_FILES=$( git diff remotes/origin/${{ github.base_ref }} --name-only | grep "\.java$" | grep -v -E "(^|/)(test|it)/" || true)
25+
if [ -n "$FILES" ]; then
26+
echo "::error::Non-test Java change found:"
27+
echo "$FILES" | while read file; do
28+
echo "::error::$file"
29+
done
30+
git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/next-release/*[a-zA-Z0-9_-]+\.json"
31+
else
32+
echo "No change that may require a changelog entry found."
33+
fi
2334
- name: Error message
2435
if: ${{ failure() }}
2536
run: |
2637
echo "::error ::No new/updated changelog entry found in /.changes/next-release directory. Please either:"
2738
echo "::error ::* Add a changelog entry (see CONTRIBUTING.md for instructions) –or–"
2839
echo "::error ::* Add the 'changelog-not-required' label to this PR (in rare cases not warranting a changelog entry)"
29-
exit 1
40+
exit 1

0 commit comments

Comments
 (0)