-
Notifications
You must be signed in to change notification settings - Fork 52
46 lines (44 loc) · 1.56 KB
/
check-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Check PR
on:
pull_request:
jobs:
check-changelog:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check Changelog modified
uses: dangoslen/changelog-enforcer@v2
with:
changeLogPath: 'CHANGELOG.md'
missingUpdateErrorMessage: |
Please include an entry into `CHANGELOG.md` to describe what happened in the PR
check-tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: files
uses: jitterbit/get-changed-files@v1
- name: Determine if Tests modified
id: modified
run: |
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ ${changed_file} =~ ^tests\/.*test_.*\.py$ ]];
then
echo "::set-output name=MODIFIED::TRUE"; # Tests were modified
exit 0
fi
done
echo "::set-output name=MODIFIED::FALSE" # Tests were not modified
exit 0
- name: Comment on PR
if: ${{ steps.modified.outputs.MODIFIED == 'FALSE' }}
uses: JoseThen/comment-pr@v1.1.0
with:
comment: |
## :warning: Tests not modified :warning:
We've noticed your Pull Request did not modify any tests :mag:
If your change requires tests, please add them :smile:
You'll notice that the `check-tests` step passed with :white_check_mark:, this
is not a confirmation that you've modified tests.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}