Add Github workflow to check for changelog entry #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: changelog | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
check-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check for [skip changelog] | |
run: | | |
PR_DESCRIPTION=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json body -q '.body') | |
if echo "$PR_DESCRIPTION" | grep -q "\[skip changelog\]"; then | |
echo "Skip changelog found in PR description. Passing the action." | |
exit 0 | |
fi | |
- name: Check for changes in doc/CHANGES.md | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }} | |
FILES_CHANGED=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }}) | |
if [[ "$FILES_CHANGED" == *"doc/CHANGES.md"* ]]; then | |
echo "doc/CHANGES.md has been modified. Passing the action." | |
exit 0 | |
else | |
echo "doc/CHANGES.md has not been modified. Failing the action." | |
exit 1 | |
fi |