diff --git a/.github/actions/changelog-verification/action.yml b/.github/actions/changelog-verification/action.yml new file mode 100644 index 0000000..8076745 --- /dev/null +++ b/.github/actions/changelog-verification/action.yml @@ -0,0 +1,31 @@ +name: 'Changelog Verification' +description: 'Verifies that a PR includes a valid changelog entry' + +runs: + using: "composite" + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup kat + uses: awslabs/aws-kotlin-repo-tools/.github/actions/setup-kat@main + + - name: Check for new changelog entry + if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }} + shell: bash + run: | + git fetch origin ${{ github.base_ref }} --depth 1 + if ! git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/[0-9a-f-]+\.json"; then + echo "::error ::No new/updated changelog entry found in /.changes directory. Please either:" + echo "::error ::* Add a changelog entry (see CONTRIBUTING.md for instructions) or" + echo "::error ::* Add the 'no-changelog' label to this PR (in rare cases not warranting a changelog entry)" + exit 1 + fi + + - name: Verify all changelogs + shell: bash + run: | + if ! kat changelog ls; then + echo "::error ::Changelog verification failed. Please check the format of your changelog entry." + exit 1 + fi