diff --git a/.gitea/workflows/compose-services-readme.yml b/.gitea/workflows/compose-services-readme.yml index 83144d8..eb1f595 100644 --- a/.gitea/workflows/compose-services-readme.yml +++ b/.gitea/workflows/compose-services-readme.yml @@ -54,12 +54,12 @@ jobs: - name: Generate combined service list run: | COMPOSE_FILES=$(find . -type f -name "docker-compose*.yml" \ - -a ! -name "*windows*" \ - -a ! -name "*gui*" \ - -a ! -name "*macos*" \ - -a ! -name "*hivemind*" \ - -a ! -name "*server*" \ - | sort) + -a ! -name "*windows*" \ + -a ! -name "*gui*" \ + -a ! -name "*macos*" \ + -a ! -name "*hivemind*" \ + -a ! -name "*server*" \ + | sort) if [ -z "$COMPOSE_FILES" ]; then echo "No docker-compose files found. Exiting." @@ -69,32 +69,16 @@ jobs: echo "Processing combined Compose files:" echo "$COMPOSE_FILES" - echo "[]" > temp_services.json - FOUND=0 + # Process all compose files together so anchors and merges resolve across files + yq -o=json eval-all 'explode(.) | .services | to_entries | map({"service": .key, "image": .value.image})' $COMPOSE_FILES \ + | jq 'unique_by(.service)' > services.json - while IFS= read -r f; do - [ -z "$f" ] && continue - echo "Processing $f" - - # Resolve merge anchors for this file - yq -o=json eval-all 'explode(.) | .services | to_entries | map({"service": .key, "image": .value.image})' "$f" > tmp.json - - # Merge into temp_services.json - jq -s 'add' temp_services.json tmp.json > temp_merged.json - mv temp_merged.json temp_services.json - - FOUND=1 - done <<< "$COMPOSE_FILES" - - if [ "$FOUND" -eq 0 ]; then - echo "No docker-compose files processed. Exiting." - exit 0 + if [ ! -s services.json ]; then + echo "No services extracted. Exiting." + exit 1 fi - # Deduplicate services - jq 'unique_by(.service)' temp_services.json > services.json - - echo "Generated services.json with all services and images." + echo "✅ Generated services.json with all services and images." - name: Generate Markdown Table uses: gazab/create-markdown-table@6686233d7008e8d8b9d4bbdbfd1fb1ae510019f0 # v1.0.7