@@ -29,62 +29,56 @@ jobs:
2929 with :
3030 python-version : " 3.11"
3131
32- - name : Install addon-check
32+ - name : Install dependencies
3333 run : |
3434 python -m pip install --upgrade pip
3535 python -m pip install kodi-addon-checker
3636
37- - name : Read addon id from addon.xml
37+ - name : Locate Addon and Read ID
3838 id : addon_meta
3939 run : |
40- set -euo pipefail
41- ADDON_ID="$(python - <<'PY'
42- from xml.etree import ElementTree as ET
43- root = ET.parse('addon.xml').getroot()
44- print(root.attrib['id'])
45- PY
46- )"
40+ # Find where addon.xml is actually located
41+ XML_PATH=$(find . -name "addon.xml" -not -path "*/.*" | head -n 1)
42+ if [ -z "$XML_PATH" ]; then
43+ echo "Error: addon.xml not found in repository!"
44+ exit 1
45+ fi
46+
47+ # Get the directory containing the xml
48+ ADDON_DIR=$(dirname "$XML_PATH")
49+
50+ # Extract ID using Python
51+ ADDON_ID=$(python3 -c "import xml.etree.ElementTree as ET; print(ET.parse('$XML_PATH').getroot().attrib['id'])")
52+
4753 echo "addon_id=${ADDON_ID}" >> "${GITHUB_OUTPUT}"
54+ echo "addon_dir=${ADDON_DIR}" >> "${GITHUB_OUTPUT}"
55+ echo "Found addon ${ADDON_ID} in ${ADDON_DIR}"
4856
49- - name : Prepare addon-check source directory
57+ - name : Prepare Clean Source Directory
5058 id : source_dir
5159 run : |
5260 set -euo pipefail
5361 WORKDIR="${RUNNER_TEMP}/addon-check-src"
5462 TARGET_DIR="${WORKDIR}/${{ steps.addon_meta.outputs.addon_id }}"
55- rm -rf "${WORKDIR}"
5663 mkdir -p "${TARGET_DIR}"
57- rsync -a ./ "${TARGET_DIR}/" \
64+
65+ # Sync from the discovered addon directory only
66+ rsync -a "${{ steps.addon_meta.outputs.addon_dir }}/" "${TARGET_DIR}/" \
5867 --exclude '.git/' \
5968 --exclude '.github/' \
6069 --exclude '.venv/' \
6170 --exclude 'venv/' \
6271 --exclude '.env/' \
63- --exclude '.vscode/' \
64- --exclude '.idea/' \
65- --exclude '.cache/' \
66- --exclude 'cache/' \
6772 --exclude '__pycache__/' \
6873 --exclude '.pytest_cache/' \
69- --exclude '.mypy_cache/' \
70- --exclude '.ruff_cache/' \
71- --exclude '.tox/' \
72- --exclude '.nox/' \
73- --exclude '.addon-check-run.log' \
74- --exclude '*.pyc' \
75- --exclude '*.pyo' \
76- --exclude '.DS_Store' \
7774 --exclude 'tests/' \
78- --exclude 'scripts/' \
79- --exclude 'package_build/' \
80- --exclude 'package_clean/' \
8175 --exclude '*.zip' \
8276 --exclude '.gitignore'
77+
8378 echo "addon_path=${TARGET_DIR}" >> "${GITHUB_OUTPUT}"
8479
8580 - name : Run addon-check
8681 run : |
87- set -euo pipefail
8882 EXTRA_ARGS=""
8983 if [[ "${{ github.event_name }}" == "pull_request" ]]; then
9084 EXTRA_ARGS="--PR"
@@ -94,16 +88,14 @@ jobs:
9488 python-syntax :
9589 name : Python Syntax Check
9690 runs-on : ubuntu-latest
97-
9891 steps :
9992 - name : Checkout repository
10093 uses : actions/checkout@v4
101-
10294 - name : Set up Python
10395 uses : actions/setup-python@v5
10496 with :
10597 python-version : " 3.11"
106-
10798 - name : Compile Python files
10899 run : |
109- python -m compileall default.py resources
100+ # Compiles everything in the repo to check for syntax errors
101+ python -m compileall .
0 commit comments