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