Update .gitea/workflows/update-factorio-modlist.yml

This commit is contained in:
2025-11-23 18:31:50 +00:00
parent 56f8a2949b
commit dd64fb920b

View File

@@ -8,9 +8,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Get list of .zip files via API
env:
GITEA_TOKEN: ${{ secrets.gamerarena }}
@@ -32,6 +29,27 @@ jobs:
# Scrive mods.json
echo "$json_array" > mods.json
- name: Delete mods.json if exists
env:
GITEA_TOKEN: ${{ secrets.gamerarena }}
GITEA_API_URL: https://git.garpnet.it/api/v1
OWNER: GamerArena
REPO: FastDL
BRANCH: main
run: |
response=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/mods.json?ref=$BRANCH")
sha=$(echo "$response" | jq -r '.sha // empty')
if [ -n "$sha" ]; then
curl -X DELETE -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"sha\":\"$sha\",\"branch\":\"$BRANCH\",\"message\":\"Delete mods.json\"}" \
"$GITEA_API_URL/repos/$OWNER/$REPO/contents/mods.json"
echo "mods.json deleted"
else
echo "mods.json does not exist, skipping delete"
fi
- name: Upload mods.json via API
env:
GITEA_TOKEN: ${{ secrets.gamerarena }}