From e8635c05872901ada35a0e4c63a4fdc4a1f38f31 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Mon, 8 Sep 2025 11:17:53 -0700 Subject: [PATCH] Update catalog.yml --- .github/workflows/catalog.yml | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/catalog.yml b/.github/workflows/catalog.yml index 0c8be3b..9837572 100644 --- a/.github/workflows/catalog.yml +++ b/.github/workflows/catalog.yml @@ -7,28 +7,10 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - echo "{" >catalog.json - c= - for d in */ .;do - [ "$d" = "./" ]&&key="root"||key="${d%/}" - files=$(find "$d" -maxdepth 1 -type f -name '*.sune'|grep -v '/\.'||:) - [ -z "$files" ]&&continue - echo "$c \"$key\": [" >>catalog.json - cc= - for f in $files;do - raw="https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_REF_NAME/$f" - n=$(jq -r '.[0].name//empty' "$f" 2>/dev/null) - a=$(jq -r '.[0].avatar//empty' "$f" 2>/dev/null) - i=$(jq -r '.[0].id//empty' "$f" 2>/dev/null) - jq -rn --arg name "${n:-$(basename "$f")}" --arg raw "$raw" --arg avatar "$a" --arg id "$i" '({name:$name,raw:$raw}+(if $avatar=="" then {} else {avatar:$avatar} end)+(if $id=="" then {} else {id:$id} end))'|sed "1s/^/$cc /" >>catalog.json - cc=, - done - echo " ]" >>catalog.json - c=, - done - echo "}" >>catalog.json - t=$(mktemp) - jq . catalog.json >"$t" && mv "$t" catalog.json + echo "[" >catalog.json;C=; + for d in . $(find . -mindepth 1 -type d ! -path '*/.*' -printf '%P\n');do S=;c=;for f in "$d"/*.sune;do [ -f "$f" ]||continue;rel=${f#./};raw="https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_REF_NAME/$rel";n=$(jq -r '.[0].name//empty' "$f" 2>/dev/null);a=$(jq -r '.[0].avatar//empty' "$f" 2>/dev/null);i=$(jq -r '.[0].id//empty' "$f" 2>/dev/null);bn=$(basename "$rel");j=$(jq -rn --arg name "${n:-$bn}" --arg raw "$raw" --arg avatar "$a" --arg id "$i" '({name:$name,raw:$raw}+(if $avatar=="" then {} else {avatar:$avatar} end)+(if $id=="" then {} else {id:$id} end))');S="$S$c$j";c=,;done;[ -n "$S" ]&&printf "%s" "$C{\"folder\":\"$d\",\"sunes\":[$S]}" >>catalog.json&&C=,;done + echo "]" >>catalog.json + t=$(mktemp);jq . catalog.json>"$t"&&mv "$t" catalog.json git config user.name bot git config user.email bot@users.noreply.github.com git add catalog.json