Skip to content

add meta/dashlets (used by ITSM Designer) #37

add meta/dashlets (used by ITSM Designer)

add meta/dashlets (used by ITSM Designer) #37

#
# GitHub Actions Workflow: Validate iTop datamodel XML v3.2
#
# This workflow runs on every pull request to the 'main' branch.
# It validates an XML data model against the corresponding XSD schema.
# The validation logic is implemented in a separate Python script.
#
name: Validate iTop datamodel XML version 3.2
on:
pull_request:
branches:
- '*'
jobs:
validate-xml:
runs-on: ubuntu-latest
env:
XSD_PATH: 3.2/itop_design.xsd
XML_PATH: test/datamodel.must-validate.xml
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine if validation is needed
id: determine
run: |
git fetch origin main
CHANGED=$(git diff --name-only origin/main...HEAD | grep '^3.2/' || true)
if [ -z "$CHANGED" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "No relevant changes in /3.2 detected. Skipping validation."
else
echo "skip=false" >> $GITHUB_OUTPUT
echo "Relevant changes detected in /3.2. Proceeding with validation."
fi
- name: Set up Python
if: steps.determine.outputs.skip == 'false'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache pip
if: steps.determine.outputs.skip == 'false'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
if: steps.determine.outputs.skip == 'false'
run: pip install -r scripts/requirements.txt
- name: Validate XML datamodel against schema
if: steps.determine.outputs.skip == 'false'
run: python scripts/validate_xml.py "$XSD_PATH" "$XML_PATH"
- name: Skip validation (no relevant changes)
if: steps.determine.outputs.skip == 'true'
run: echo "✅ No relevant changes in /3.2. Validation skipped."
- name: Add workflow summary
run: |
echo "## Workflow Summary: Validate iTop datamodel XML version 3.2" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "This workflow automatically validates the iTop datamodel XML against the version 3.2 XSD schema on every pull request to the main branch." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Key Features:**" >> $GITHUB_STEP_SUMMARY
echo "- Change detection to skip unnecessary validation runs." >> $GITHUB_STEP_SUMMARY
echo "- Pip cache for faster dependency installation." >> $GITHUB_STEP_SUMMARY
echo "- Automated schema validation using Python." >> $GITHUB_STEP_SUMMARY
echo "- Clear output for both skipped and validated runs." >> $GITHUB_STEP_SUMMARY