Skip to content

Commit

Permalink
Merge pull request #4949 from Serene-Arc/changelog_workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Serene-Arc authored Oct 30, 2023
2 parents d80d459 + 2af9a8c commit 1fdf075
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ Fixes #X. <!-- Insert issue number here if applicable. -->

## To Do

- [ ] Documentation. (If you've add a new command-line flag, for example, find the appropriate page under `docs/` to describe it.)
- [ ] Changelog. (Add an entry to `docs/changelog.rst` near the top of the document.)
- [ ] Tests. (Encouraged but not strictly required.)
<!--
- If you believe one of below checkpoints is not required for the change you
are submitting, cross it out and check the box nonetheless to let us know.
For example: - [x] ~Changelog~
- Regarding the changelog, often it makes sense to add your entry only once
reviewing is finished. That way you might prevent conflicts from other PR's in
that file, as well as keep the chance high your description fits with the
latest revision of your feature/fix.
- Regarding documentation, bugfixes often don't require additions to the docs.
- Please remove the descriptive sentences in braces from the enumeration below,
which helps to unclutter your PR description.
-->

- [ ] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under `docs/` to describe it.)
- [ ] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of one of the lists near the top of the document.)
- [ ] Tests. (Very much encouraged but not strictly required.)
33 changes: 33 additions & 0 deletions .github/workflows/changelog_reminder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Verify changelog updated

on:
pull_request:
types:
- opened
- ready_for_review


jobs:
check_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- 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@v2
with:
message: 'Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
if: contains(env.CHANGED_FILES, '.py') && !contains(env.CHANGED_FILES, 'changelog.rst')

0 comments on commit 1fdf075

Please sign in to comment.