diff --git a/.gitea/actions/discover-skins/action.yml b/.gitea/actions/discover-skins/action.yml index 4459bfd..140bd58 100644 --- a/.gitea/actions/discover-skins/action.yml +++ b/.gitea/actions/discover-skins/action.yml @@ -27,20 +27,22 @@ runs: shell: bash run: | echo "Discovering all skins in $SKINS_DIR…" - temp_discover="/tmp/discover_skins_$RANDOM.txt" - find "$SKINS_DIR" -mindepth 1 -maxdepth 1 -type d \ - | sed 's|'"$SKINS_DIR"'/||' > "$temp_discover" - mapfile -t skins < "$temp_discover" - rm -f "$temp_discover" - - json="" - json="$(printf '%s\n' "${skins[@]}" | jq -R . | jq -cs .)" + + # Find all skins and create JSON, write to shared file + all_skins_file="/tmp/all_skins_shared.json" + find "$SKINS_DIR" -mindepth 1 -maxdepth 1 -type d -print0 \ + | xargs -0 -n1 basename \ + | jq -R . | jq -cs . > "$all_skins_file" + + json=$(cat "$all_skins_file") { echo "all_skins<> "$GITHUB_OUTPUT" + + echo "all_skins_file=$all_skins_file" >> "$GITHUB_OUTPUT" - name: Detect Changed Skin Directories id: detect @@ -49,12 +51,9 @@ runs: set -e echo "[Detect Changed Skin Directories Started]" - # Parse JSON back into Bash array - avoid command substitution with parentheses - all_skins_json='${{ steps.discover_all.outputs.all_skins }}' - temp_skins_file="/tmp/all_skins_$RANDOM.txt" - printf '%s' "$all_skins_json" | jq -r '.[]' > "$temp_skins_file" - mapfile -t all_skins < "$temp_skins_file" - rm -f "$temp_skins_file" + # Read from shared file instead of using GitHub Actions output + all_skins_file="/tmp/all_skins_shared.json" + mapfile -t all_skins < <(jq -r '.[]' "$all_skins_file") force_rebuild="${{ inputs.force_rebuild }}" target_skins="${{ inputs.target_skins }}"