2026-09-18 06:08:44 +08:00

62 lines
1.9 KiB
YAML

name: Validate UI XML
description: Validates Qt UI XML files
inputs:
failCondition:
description: Controls whether failed checks also fail the workflow run
required: false
default: never
workingDirectory:
description: Working directory for checks
required: false
default: ${{ github.workspace }}
runs:
using: composite
steps:
- name: Check Runner Operating System 🏃‍♂️
if: runner.os == 'Windows'
shell: bash
run: |
: Check Runner Operating System 🏃‍♂️
echo "::notice::qt-xml-validator action requires an Linux-based or macOS-based runner."
exit 2
- name: Install xmllint 🕵️
if: runner.os == 'Linux'
shell: bash
run: |
: Install xmllint 🕵️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
echo ::group::Installing libxml2-utils
sudo apt-get -qq update
sudo apt-get install --no-install-recommends -y libxml2-utils
echo ::endgroup::
- name: Register Annotations 📝
uses: korelstar/xmllint-problem-matcher@dd2ad21bd8a2de0187cb621419537f345e7e509c # v1.3.0
- name: Check for Changed Files ✅
uses: ./.github/actions/check-changes
id: checks
with:
checkGlob: 'frontend/forms/**/*.ui'
- name: Validate XML 💯
if: fromJSON(steps.checks.outputs.hasChangedFiles)
id: result
shell: bash
env:
CHANGED_FILES: ${{ steps.checks.outputs.changedFiles }}
run: |
: Validate XML 💯
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
CHANGED_FILES=($(echo "${CHANGED_FILES//[\[\]\'\"]/}" | tr "," "\n"))
if (( ${#CHANGED_FILES[@]} )); then
if [[ '${{ inputs.failCondition }}' == never ]]; then set +e; fi
xmllint \
--schema ${{ github.workspace }}/frontend/forms/XML-Schema-Qt5.15.xsd \
--noout "${CHANGED_FILES[@]}"
fi