Update workflow

This commit is contained in:
Serene-Arc 2023-10-29 17:49:28 +10:00
parent 8e815049fa
commit dcc5f3a47d

View file

@ -1,33 +1,35 @@
name: Verify changelog updated
on:
push:
paths:
- '**.rst'
- '**.py'
pull_request:
paths:
- '**.rst'
- '**.py'
types:
- opened
- ready_for_review
jobs:
check:
check_changes:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout repo
uses: actions/checkout@v2
- name: Check for Change Log Modification
run: |
changelog_modified=$(echo "$changed_files" | grep '^CHANGELOG.rst$' || true)
if [ -z "$changelog_modified" ] && [ ! -z "$python_or_rst_modified" ]
then
echo "Error: Changelog not modified while .rst or .py files have been modified"
exit 1
else
echo "Changelog modified or no .rst/.py files have been modified"
fi
- name: Get changed files
id: getfile
run: |
echo "Files changed:"
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
echo "$CHANGED_FILES"
echo "CHANGED_FILES<<EOF" >> $GITHUB_ENV
echo "$CHANGED_FILES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Comment PR
uses: thollander/actions-comment-pull-request@master
with:
message: 'Thank you for the PR! The changelog has not been updated so here is a friendly reminder to check if you need at add an entry.'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
if: contains(fromJson(env.CHANGED_FILES), '.py') && !contains(fromJson(env.CHANGED_FILES), 'changelog.rst')