Skip to content

[pull] gh-pages from OctoPrint:gh-pages #250

[pull] gh-pages from OctoPrint:gh-pages

[pull] gh-pages from OctoPrint:gh-pages #250

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 )