Skip to content

Apache Lucene open-source search software

Use diff exit code correctly in changelolg verifier (#14628)

Stefan Voditaf27566da487f
diff --git a/.github/workflows/verify-changelog-and-set-milestone.yml b/.github/workflows/verify-changelog-and-set-milestone.yml
index 5c671cf8ed3..a893e02e582 100644
--- a/.github/workflows/verify-changelog-and-set-milestone.yml
+++ b/.github/workflows/verify-changelog-and-set-milestone.yml
@@ -45,8 +45,7 @@ jobs:
# Add and fetch full history of the base branch
BASE_BRANCH=${{ github.event.pull_request.base.ref }}
# We need this to ensure we will be able to find the merge base
- git fetch --unshallow || true
- git fetch upstream $BASE_BRANCH
+ git fetch upstream $BASE_BRANCH --unshallow
# Find merge base commit to diff against
BASE_COMMIT=$(git merge-base HEAD upstream/$BASE_BRANCH)
@@ -57,8 +56,7 @@ jobs:
git log --oneline -n 3 HEAD
echo "Diff:"
- git diff --name-only $BASE_COMMIT HEAD -- ${{ env.CHANGE_LOG_FILE }}
- if ! git diff --name-only $BASE_COMMIT HEAD -- ${{ env.CHANGE_LOG_FILE }}; then
+ if git diff --exit-code --name-only $BASE_COMMIT HEAD -- ${{ env.CHANGE_LOG_FILE }}; then
echo "Change log file:${{ env.CHANGE_LOG_FILE }} does not contains an entry corresponding to changes introduced in PR. Please add a changelog entry."
exit 0
else