From 83e6ba8077fc04b680035d40019330f1dec3ea2d Mon Sep 17 00:00:00 2001 From: Mathias Elle Date: Tue, 20 Aug 2024 00:20:26 +0200 Subject: [PATCH] Add check for changelog entry in GitHub Actions workflow --- .github/workflows/check-changelog.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml index c224b7e..690da0a 100644 --- a/.github/workflows/check-changelog.yml +++ b/.github/workflows/check-changelog.yml @@ -12,7 +12,9 @@ jobs: - name: Check for changelog entry run: | - if ! git diff --name-only HEAD^ HEAD | grep -q 'CHANGELOG.md'; then + BASE_BRANCH=$(jq -r .pull_request.base.ref < $GITHUB_EVENT_PATH) + MERGE_BASE=$(git merge-base HEAD $BASE_BRANCH) + if ! git diff --name-only $MERGE_BASE HEAD | grep -q 'CHANGELOG.md'; then echo "No changelog entry found. Please add an entry to CHANGELOG.md." exit 1 fi