-
Notifications
You must be signed in to change notification settings - Fork 343
47 lines (40 loc) · 1.78 KB
/
validate-pull-requests.yml
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
47
name: Validate PRs
on:
pull_request:
jobs:
validate-plugin-files:
name: Validate changed plugin files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: src
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/checkout@v3
with:
path: current
ref: gh-pages
- name: 🐍 Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: 🐍 Install requirements
run: |
pip install -r ./current/.github/scripts/requirements.txt
- name: 🕵️♂ Validate front matter
run: |
echo "Validating changed plugin files between ${{ github.event.pull_request.base.sha }} and ${{ github.event.pull_request.head.sha }}"
cd src
git diff-tree --no-commit-id --name-status -r ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
while read modifier file; do
if [[ $file == _plugins/* ]] && [[ $file == *.md ]]; then
if [ "$modifier" == "M" ]; then
echo "MODIFIED: $file"
python ../current/.github/scripts/validate_front_matter.py "$file" --debug --check-date-unchanged=${{ github.event.pull_request.base.sha }} --action-output
elif [ "$modifier" == "A" ]; then
echo "ADDED: $file"
python ../current/.github/scripts/validate_front_matter.py "$file" --debug --check-internal-assets --check-id-match --check-py3-compat --action-output
fi
fi
done < <(git diff-tree --no-commit-id --name-status -r ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | xargs -n2 )