1
0
Files
balatro-mod-index/.github/workflows/fetch-upstream-mods.yml

48 lines
1.4 KiB
YAML

name: fetch upstream mod changes
on:
schedule:
- cron: '13,43 * * * *'
workflow_dispatch:
jobs:
replace-mods:
runs-on: ubuntu-latest
steps:
- name: Clone Gitea repo via SSH
run: |
rm -rf /tmp/upstream
git clone ssh://git@smallgit.dasguney.com:2222/skyline/balatro-mod-index.git repo
- name: Clone upstream GitHub repo
run: |
git clone https://github.com/skyline69/balatro-mod-index.git /tmp/upstream
- name: Replace mods directory
run: |
cd repo
rm -rf mods
cp -a /tmp/upstream/mods ./mods
- name: Append last-updated timestamp
run: |
cd repo
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: |
cd repo
git config user.name 'jim[bot]'
git config user.email 'jim[bot]@users.noreply.github.com'
git config core.sshCommand "ssh -p 2222"
git config lfs.locksverify false
git remote set-url origin git@smallgit.dasguney.com:skyline/balatro-mod-index.git
git add mods
if git commit -m "fetch upstream mod changes ($(date --utc +%Y%m%d_%H%M%SZ))"; then
git push origin main
fi