Skip to content

Commit 8ab0363

Browse files
authored
misc: add reusable changelog-verification action (#93)
1 parent 1a71c5d commit 8ab0363

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Changelog Verification'
2+
description: 'Verifies that a PR includes a valid changelog entry'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Checkout sources
8+
uses: actions/checkout@v4
9+
10+
- name: Setup kat
11+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/setup-kat@main
12+
13+
- name: Check for new changelog entry
14+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
15+
shell: bash
16+
run: |
17+
git fetch origin ${{ github.base_ref }} --depth 1
18+
if ! git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/[0-9a-f-]+\.json"; then
19+
echo "::error ::No new/updated changelog entry found in /.changes directory. Please either:"
20+
echo "::error ::* Add a changelog entry (see CONTRIBUTING.md for instructions) or"
21+
echo "::error ::* Add the 'no-changelog' label to this PR (in rare cases not warranting a changelog entry)"
22+
exit 1
23+
fi
24+
25+
- name: Verify all changelogs
26+
shell: bash
27+
run: |
28+
if ! kat changelog ls; then
29+
echo "::error ::Changelog verification failed. Please check the format of your changelog entry."
30+
exit 1
31+
fi

0 commit comments

Comments
 (0)