taiko-web-db/pull.sh
2024-04-09 10:59:51 +00:00

17 lines
906 B
Bash

#!/bin/bash
docker exec -i taiko-mongo mongoexport --db taiko --collection users --out /dev/stdout | sort -n > users.json
docker exec -i taiko-mongo mongoexport --db taiko --collection songs --out /dev/stdout | sort -n > songs.json
docker exec -i taiko-mongo mongoexport --db taiko --collection scores --out /dev/stdout | sort -n > scores.json
docker exec -i --user=git forgejo /bin/bash -c "cd /data/git/repositories/yuuki/taiko-mongo-realtime.git && git reflog expire --expire-unreachable=now --all"
docker exec -i --user=git forgejo /bin/bash -c "cd /data/git/repositories/yuuki/taiko-mongo-realtime.git && git gc --aggressive --prune=now"
git reflog expire --expire-unreachable=now --all
git gc --aggressive --prune=now
git add *.json
changed=$(git diff --name-only --cached | paste -s -d " ")
git commit --author="BOT <bot@example.com>" -m "$changed が更新されました"
git push origin main