From 67f4d4ac6276173d547f46fe85b2eb590cfeedb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96=2E=20Efe=20D=2E?= <67526259+skyline69@users.noreply.github.com> Date: Wed, 24 Dec 2025 02:49:33 +0100 Subject: [PATCH] Add upstream sync workflow (Gitea) --- .github/workflows/fetch-upstream-mods.yml | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/fetch-upstream-mods.yml diff --git a/.github/workflows/fetch-upstream-mods.yml b/.github/workflows/fetch-upstream-mods.yml new file mode 100644 index 00000000..88ab9af6 --- /dev/null +++ b/.github/workflows/fetch-upstream-mods.yml @@ -0,0 +1,48 @@ +name: fetch upstream mod changes + +on: + schedule: + - cron: '13,43 * * * *' + workflow_dispatch: + +jobs: + replace-mods: + runs-on: ubuntu-latest + + steps: + - name: Checkout current Gitea repo + uses: actions/checkout@v4 + with: + lfs: true + + - name: Clone upstream GitHub repo + run: | + git clone https://github.com/skyline69/balatro-mod-index.git /tmp/upstream + + - name: Replace mods directory + run: | + rm -rf mods + cp -a /tmp/upstream/mods ./mods + + - name: Install deps + run: | + sudo apt-get update + sudo apt-get install -y jq moreutils + + - name: Append last-updated timestamp + run: | + TIME_NOW=$(date +"%s") + git diff -z --name-only | grep -z meta.json | while IFS='' read -r -d '' file; do + jq --indent 2 '."last-updated" |= (. // '"$TIME_NOW"')' "$file" | sponge "$file" + done + + - name: Commit and push + run: | + git config user.name "gitea-bot" + git config user.email "bot@smallgit.dasguney.com" + + git add mods + if git commit -m "fetch upstream mod changes ($(date --utc +%Y%m%d_%H%M%SZ))"; then + git push + fi +