diff --git a/.github/workflows/changelog-check.yaml b/.github/workflows/changelog-check.yaml new file mode 100644 index 0000000000..a66d6f0fd5 --- /dev/null +++ b/.github/workflows/changelog-check.yaml @@ -0,0 +1,33 @@ +name: Check Changelog + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + check-changelog: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Check if changelog exists in PR + id: check_for_changelog + run: | + git fetch origin ${{ github.base_ref }} --depth=1 + if git diff --name-only origin/${{ github.base_ref }} | grep -q 'CHANGELOG.md'; then + echo "Changelog file found." + echo "changelog_exists=true" >> $GITHUB_ENV + else + echo "Changelog file not found." + echo "changelog_exists=false" >> $GITHUB_ENV + fi + + - name: Fail if no changelog + if: env.changelog_exists == 'false' + run: | + echo "Error: No CHANGELOG.md file found in this Pull Request." + exit 1 \ No newline at end of file