Skip to content

Commit

Permalink
add changelog check
Browse files Browse the repository at this point in the history
  • Loading branch information
linrunqi08 committed Jul 18, 2024
1 parent 8fc252e commit 21d5658
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/changelog-check.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 21d5658

Please # to comment.