Update GitHub workflows #11
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 | |
- edited | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ github.token }} | |
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 | |
else | |
exit 1 | |
fi | |
- name: Check for changes in doc/CHANGES.md | |
if: failure() | |
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 |