diff --git a/.github/workflows/check_changelog.yaml b/.github/workflows/check_changelog.yaml index 19adc5ff8..1ddd76793 100644 --- a/.github/workflows/check_changelog.yaml +++ b/.github/workflows/check_changelog.yaml @@ -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 \ No newline at end of file + - 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<> $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')