Tgra/add vcard shape #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate SHACL Shapes on PR | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'shapes/**/*.ttl' | |
| jobs: | |
| main-pr-validation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # needed to compare with origin/main | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| pip install pyshacl rdflib rich | |
| - name: Determine changed TTL files | |
| id: changes | |
| run: | | |
| git fetch origin main | |
| # Get list of changed TTL files in PR | |
| changed_files=$(git diff --name-only origin/main...HEAD -- 'shapes/**/*.ttl' || true) | |
| echo "Changed TTL files:" | |
| echo "$changed_files" | |
| # Output to GitHub Actions | |
| echo "changed_files<<EOF" >> $GITHUB_OUTPUT | |
| echo "$changed_files" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Validate SHACL shapes for changed files | |
| if: steps.changes.outputs.changed_files != '' | |
| run: | | |
| echo "Validating changed TTL files:" | |
| echo "${{ steps.changes.outputs.changed_files }}" | |
| ok=true | |
| for file in ${{ steps.changes.outputs.changed_files }}; do | |
| echo "───────────────────────────────" | |
| echo "Validating $file..." | |
| python shapes/scripts/validate-shacl-shapes-file.py "$file" || ok=false | |
| done | |
| $ok || exit 1 | |
| - name: Metadata & immutability checks for changed files | |
| if: steps.changes.outputs.changed_files != '' | |
| run: | | |
| python scripts/check-metadata-and-immutability-file.py ${{ steps.changes.outputs.changed_files }} | |
| - name: Namespace & naming checks for changed files | |
| if: steps.changes.outputs.changed_files != '' | |
| run: | | |
| python scripts/check-namespaces-and-names-file.py ${{ steps.changes.outputs.changed_files }} |