From 61ea3e9fb2f4e8bd0652d871ce57abac7e470df2 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Wed, 31 Dec 2025 08:14:02 -0800 Subject: [PATCH] Feat: Create reusable catalog generation workflow --- .github/workflows/catalog.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/catalog.yml diff --git a/.github/workflows/catalog.yml b/.github/workflows/catalog.yml new file mode 100644 index 0000000..74d309a --- /dev/null +++ b/.github/workflows/catalog.yml @@ -0,0 +1,23 @@ +name: Catalog Generator + +on: + workflow_call: + +jobs: + c: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Generate and Push Catalog + run: | + 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 + git commit -m "update catalog" || true + git push