diff --git a/.gitea/workflows/update-factorio-modlist.yml b/.gitea/workflows/update-factorio-modlist.yml index 0dbe97a..869ae52 100644 --- a/.gitea/workflows/update-factorio-modlist.yml +++ b/.gitea/workflows/update-factorio-modlist.yml @@ -8,10 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: Setup Git - run: | - git config --global user.name "Gitea Action" - git config --global user.email "action@gitea.local" + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq - name: Get list of .zip files via API env: @@ -34,15 +32,16 @@ jobs: # Scrive mods.json echo "$json_array" > mods.json - - name: Commit and push mods.json + - name: Upload mods.json via API env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITEA_TOKEN: ${{ secrets.gamerarena }} + GITEA_API_URL: https://git.garpnet.it/api/v1 + OWNER: GamerArena + REPO: FastDL + BRANCH: main run: | - # Clona repo temporaneamente - git clone https://git.garpnet.it/GamerArena/FastDL.git - - - # Commit e push - git add mods.json - git commit -m "Update mods.json with .zip files" - git push origin main \ No newline at end of file + content=$(base64 -w 0 mods.json) + curl -X PUT -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"content\":\"$content\",\"branch\":\"$BRANCH\",\"message\":\"Update mods.json\"}" \ + "$GITEA_API_URL/repos/$OWNER/$REPO/contents/mods.json" \ No newline at end of file