Skip to content

Adds a Gihub Actions workflow to test for XML encoding errors #4

Adds a Gihub Actions workflow to test for XML encoding errors

Adds a Gihub Actions workflow to test for XML encoding errors #4

Workflow file for this run

---
name: Quality Assurance
on:
pull_request:
push:
branches: master
jobs:
parse-xml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install lxml
- uses: jannekem/run-python-script-action@v1
with:
script: |
from pathlib import Path
from lxml.etree import parse
encountered_errors = []
root_path = Path.cwd()
for file in root_path.rglob("*.xml"):
try:
parse(str(file))
except Exception as e:
message = str(e).replace(f"{file.name}, ", "(")
encountered_errors.append(f"{file.relative_to(root_path)}: {message}")
if encountered_errors:
raise SystemExit(int(encountered_error))
...