mirror of
https://github.com/sune-org/store.git
synced 2026-01-14 08:38:15 +00:00
Update catalog.yml
This commit is contained in:
26
.github/workflows/catalog.yml
vendored
26
.github/workflows/catalog.yml
vendored
@@ -7,10 +7,28 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: |
|
- run: |
|
||||||
echo "[" >catalog.json;c=;
|
echo "{" >catalog.json
|
||||||
for f in *.sune;do [ -f "$f" ]||continue;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:-$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/^/$c /">>catalog.json;c=,;done
|
c=
|
||||||
echo "]" >>catalog.json
|
for d in */ .;do
|
||||||
t=$(mktemp);jq . catalog.json>"$t"&&mv "$t" catalog.json
|
[ "$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
|
||||||
git config user.name bot
|
git config user.name bot
|
||||||
git config user.email bot@users.noreply.github.com
|
git config user.email bot@users.noreply.github.com
|
||||||
git add catalog.json
|
git add catalog.json
|
||||||
|
|||||||
Reference in New Issue
Block a user