Skip to content

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

Adds a Gihub Actions workflow to test for XML encoding errors

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

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, XMLSyntaxError
encountered_errors = []
root_path = Path.cwd()
for file in root_path.rglob("*.xml"):
try:
parse(str(file))
except XMLSyntaxError as e:
encountered_errors.append(f"{file.relative_to(root_path)}: {e.msg}")
if encountered_errors:
print("\nInvalid XML encodings were found:")
print("---------------------------------")
print("\n".join(encountered_errors) + "\n")
raise SystemExit(1)
...