-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github workflow to check for changelog entry
When creating PR we should update the changelog as this helps others see what is upcoming in the next release and makes release Alaveteli versions easier. This workflow ensures an `docs/CHANGES.md` is modified or the pull request description contains `[skip changelog]` Update the PR template to help remind devs to do this before the PR is created.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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 |