From 57326e597c9cf8f75cf82d63db9f45d28b5d5f3a Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Wed, 20 May 2026 01:33:43 +0000 Subject: [PATCH] fix(ci): initialize missing_required before source dir check, handle empty SOURCE_DIR Authored-by: Moko Consulting --- .gitea/workflows/repo-health.yml | 41 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/repo-health.yml b/.gitea/workflows/repo-health.yml index 5eb6362..90c86c2 100644 --- a/.gitea/workflows/repo-health.yml +++ b/.gitea/workflows/repo-health.yml @@ -392,20 +392,6 @@ jobs: exit 0 fi - # Source directory: src/ or htdocs/ (either is valid for extension repos) - if [ -d "src" ]; then - SOURCE_DIR="src" - elif [ -d "htdocs" ]; then - SOURCE_DIR="htdocs" - else - # Platform/tooling repos (deploy/, cli/, monitoring/) don't need src/ - if [ -d "deploy" ] || [ -d "cli" ] || [ -d "monitoring" ]; then - SOURCE_DIR="(platform repo)" - else - missing_required+=("src/ or htdocs/ (source directory required)") - fi - fi - IFS=',' read -r -a required_artifacts <<< "${REPO_REQUIRED_ARTIFACTS}" IFS=',' read -r -a optional_files <<< "${REPO_OPTIONAL_FILES}" IFS=',' read -r -a disallowed_dirs <<< "${REPO_DISALLOWED_DIRS}" @@ -414,6 +400,19 @@ jobs: missing_required=() missing_optional=() + # Source directory: src/ or htdocs/ (either is valid for extension repos) + SOURCE_DIR="" + if [ -d "src" ]; then + SOURCE_DIR="src" + elif [ -d "htdocs" ]; then + SOURCE_DIR="htdocs" + elif [ -d "deploy" ] || [ -d "cli" ] || [ -d "monitoring" ]; then + # Platform/tooling repos don't need src/ + SOURCE_DIR="" + else + missing_required+=("src/ or htdocs/ (source directory required)") + fi + for item in "${required_artifacts[@]}"; do if printf '%s' "${item}" | grep -q '/$'; then d="${item%/}" @@ -579,12 +578,14 @@ jobs: joomla_findings+=("updates.xml missing in root (required for Joomla update server)") fi - INDEX_DIRS=("${SOURCE_DIR}" "${SOURCE_DIR}/admin" "${SOURCE_DIR}/site") - for dir in "${INDEX_DIRS[@]}"; do - if [ -d "${dir}" ] && [ ! -f "${dir}/index.html" ]; then - joomla_findings+=("${dir}/index.html missing (directory listing protection)") - fi - done + if [ -n "${SOURCE_DIR}" ]; then + INDEX_DIRS=("${SOURCE_DIR}" "${SOURCE_DIR}/admin" "${SOURCE_DIR}/site") + for dir in "${INDEX_DIRS[@]}"; do + if [ -d "${dir}" ] && [ ! -f "${dir}/index.html" ]; then + joomla_findings+=("${dir}/index.html missing (directory listing protection)") + fi + done + fi if [ "${#joomla_findings[@]}" -gt 0 ]; then {