diff --git a/.gitea/actions/discover-skins/action.yml b/.gitea/actions/discover-skins/action.yml index dec5514..89e8788 100644 --- a/.gitea/actions/discover-skins/action.yml +++ b/.gitea/actions/discover-skins/action.yml @@ -32,7 +32,6 @@ runs: | sed 's|'"$SKINS_DIR"'/||' ) - # Convert to compact JSON json=$(printf '%s\n' "${skins[@]}" | jq -R . | jq -cs .) { @@ -121,25 +120,22 @@ runs: echo " ✓ ${#uniq_skins[@]} valid skin names after cleaning" echo "" + echo "[Writing Changed Skins to File]" + changed_skins_file=$(mktemp) + if [ "${#uniq_skins[@]}" -eq 0 ]; then echo "→ No added/modified skins detected." - { - echo "changed_skins_file<> "$GITHUB_OUTPUT" + echo "[]" > "$changed_skins_file" else - echo "[Writing Changed Skins to File]" - changed_skins_file=$(mktemp) - printf "%s\n" "${uniq_skins[@]}" > "$changed_skins_file" - echo " ✓ Skins written to $changed_skins_file" - - { - echo "changed_skins_file<> "$GITHUB_OUTPUT" + printf '%s\n' "${uniq_skins[@]}" | jq -R . | jq -cs . > "$changed_skins_file" + echo " ✓ Skins written to $changed_skins_file (JSON array)" fi + { + echo "changed_skins_file<> "$GITHUB_OUTPUT" + echo "" echo "[Detect Changed Skin Directories Complete — ${#uniq_skins[@]} skins processed, ${#deleted_skins[@]} skins deleted]" diff --git a/.gitea/actions/generate-icons/action.yml b/.gitea/actions/generate-icons/action.yml index f851882..6ca97cf 100644 --- a/.gitea/actions/generate-icons/action.yml +++ b/.gitea/actions/generate-icons/action.yml @@ -3,7 +3,7 @@ description: "Generate WEBP mod icons from skins and convert panel/thumbnail PNG inputs: changed_skins_file: - description: "Path to file with changed skins" + description: "Path to file containing changed skins (JSON array)" required: true runs: @@ -19,7 +19,7 @@ runs: exit 0 fi - mapfile -t skin_dirs < "${{ inputs.changed_skins_file }}" + mapfile -t skin_dirs < <(jq -r '.[]' "${{ inputs.changed_skins_file }}") [ "${#skin_dirs[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; } sanitize_filename() { @@ -80,7 +80,6 @@ runs: elif [ -f "${DEFAULT_SKIN_DIR}/selection-mod-${icon}@2x.png" ]; then file="${DEFAULT_SKIN_DIR}/selection-mod-${icon}@2x.png" fi - [ -n "$file" ] && montage_files+=("$file") done @@ -121,7 +120,7 @@ runs: exit 0 fi - mapfile -t skins < "${{ inputs.changed_skins_file }}" + mapfile -t skins < <(jq -r '.[]' "${{ inputs.changed_skins_file }}") [ "${#skins[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; } convert_pngs_to_webp() { diff --git a/.gitea/actions/pull-lfs/action.yml b/.gitea/actions/pull-lfs/action.yml index 9106769..71bb249 100644 --- a/.gitea/actions/pull-lfs/action.yml +++ b/.gitea/actions/pull-lfs/action.yml @@ -3,7 +3,7 @@ description: "Pull only LFS objects for changed skins and core assets" inputs: changed_skins_file: - description: "Path to file containing changed skins" + description: "Path to file containing changed skins (JSON array)" required: false default: "" @@ -18,15 +18,17 @@ runs: exit 0 fi + mapfile -t skins < <(jq -r '.[]' "${{ inputs.changed_skins_file }}") + [ "${#skins[@]}" -eq 0 ] && { echo "No skins to process. Exiting."; exit 0; } + includes="src/**,export/**,media/**" skin_includes=$( - while IFS= read -r skin; do + for skin in "${skins[@]}"; do esc=$(printf '%s' "$skin" \ | sed -e 's/\[/\\[/g' -e 's/\]/\\]/g') printf 'Skins/%s/**\n' "$esc" - done < "${{ inputs.changed_skins_file }}" \ - | paste -sd ',' + done | paste -sd ',' ) includes="$includes,$skin_includes"