Skip to content

Update bavet129 130 #1857

Update bavet129 130

Update bavet129 130 #1857

Workflow file for this run

name: Validate PR
on: pull_request
defaults:
run:
shell: bash
working-directory: project
jobs:
test:
runs-on: ubuntu-latest
steps:
# checkout code
- name: Checkout
uses: actions/checkout@v4
with:
path: project
fetch-depth: 2
# checkout schema as xmllint can't https
- name: Checkout schema repo
uses: actions/checkout@v4
with:
repository: BetaMasaheft/Schema
path: schema
- name: Install Test Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils
# Compare locally changed files to PR's base
- name: Check for changed source files
id: changed
run: |
{
echo "FILES=$(git diff --name-only --diff-filter=ACMRT \
${{ github.event.pull_request.base.sha }} \
${{ github.sha }} \
-- ':./**/*.xml' ':!*/transkribus*.xml' ':!*/facsimile*.xml' \
':!./**/edition.xml' ':!./**/msDesc.xml' ':!./**/*text.xml' \
':!./**/taxonomy.xml' ':*.xml' ':!build.xml' ':!expath-pkg.xml' ':!repo.xml' | xargs)"
} >> "$GITHUB_OUTPUT"
# If no xml files were modified ...
- name: No source files changed
if: ${{ steps.changed.outputs.FILES == '' }}
run: |
echo "All good"
# ... otherwise
- name: List modified documents
env:
FILES: ${{ steps.changed.outputs.FILES }}
if: ${{ steps.changed.outputs.FILES != '' }}
run: |
echo "modified: $FILES"
# Validate changed files against latest schema
- name: Validate changed source files
env:
FILES: ${{ steps.changed.outputs.FILES }}
if: ${{ steps.changed.outputs.FILES != '' }}
run: |
xmllint \
--noout --xinclude --nowarning \
--relaxng ../schema/tei-betamesaheft.rng \
$FILES \
2>&1 | \
{ grep -vE 'RNG|validates' || :; }
# ensure branch contains only well-formed xml files
- name: Ensure all XML files are well formed
run: |
xmllint --noout \
$(find . -type f -name '*.xml')