56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
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
|
|
persist-credentials: false
|
|
|
|
- name: Clone upstream GitHub repo
|
|
run: |
|
|
rm -rf /tmp/upstream
|
|
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: 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: force SSH remote for gitea
|
|
run: |
|
|
git remote set-url origin git@smallgit.dasguney.com:skyline/balatro-mod-index.git
|
|
git remote -v
|
|
|
|
- name: disable lfs lock verification
|
|
run: |
|
|
git config lfs.locksverify false
|
|
|
|
- name: commit changes
|
|
run: |
|
|
git config --global user.name 'jim[bot]'
|
|
git config --global user.email 'jim[bot]@users.noreply.github.com'
|
|
|
|
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
|
|
|