Update .gitea/workflows/update-factorio-modlist.yml
This commit is contained in:
@@ -18,7 +18,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Prende la lista di file nella root del repo
|
# Prende la lista di file nella root del repo
|
||||||
response=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
|
response=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
|
||||||
"$GITEA_API_URL/repos/$OWNER/$REPO/contents?ref=$BRANCH")
|
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/Factorio?ref=$BRANCH")
|
||||||
|
|
||||||
# Filtra solo i file .zip e crea array JSON
|
# Filtra solo i file .zip e crea array JSON
|
||||||
zip_files=$(echo "$response" | jq -r '.[] | select(.type=="file") | select(.name|endswith(".zip")) | .name')
|
zip_files=$(echo "$response" | jq -r '.[] | select(.type=="file") | select(.name|endswith(".zip")) | .name')
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
BRANCH: main
|
BRANCH: main
|
||||||
run: |
|
run: |
|
||||||
response=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
|
response=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
|
||||||
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/mods.json?ref=$BRANCH")
|
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/Factorio/mods.json?ref=$BRANCH")
|
||||||
sha=$(echo "$response" | jq -r '.sha // empty')
|
sha=$(echo "$response" | jq -r '.sha // empty')
|
||||||
if [ -n "$sha" ]; then
|
if [ -n "$sha" ]; then
|
||||||
curl -X DELETE -H "Authorization: token $GITEA_TOKEN" \
|
curl -X DELETE -H "Authorization: token $GITEA_TOKEN" \
|
||||||
@@ -62,4 +62,4 @@ jobs:
|
|||||||
curl -X PUT -H "Authorization: token $GITEA_TOKEN" \
|
curl -X PUT -H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"content\":\"$content\",\"branch\":\"$BRANCH\",\"message\":\"Update mods.json\"}" \
|
-d "{\"content\":\"$content\",\"branch\":\"$BRANCH\",\"message\":\"Update mods.json\"}" \
|
||||||
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/mods.json"
|
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/Factorio/mods.json"
|
||||||
Reference in New Issue
Block a user