Files
hitster.gameset_database/.gitea/workflows/update.yaml
T

34 lines
1.0 KiB
YAML

name: automatically check for updates
on:
push:
schedule:
- cron: "0 */12 * * *"
jobs:
Check_for_update:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: update hitster gameset database
run: |
wget https://hitster.jumboplay.com/hitster-assets/gameset_database.json -O gameset_database.json
rm -f gameset_database.json.*
- name: git commit
run: |
git config user.name "${{ secrets.GIT_USERNAME }}"
git config user.email "${{ secrets.GIT_USEREMAIL }}"
# Python leest de JSON uit zonder apt-dependencies
updated_on=$(python3 -c "import json; print(json.load(open('./gameset_database.json'))['updated_on'])")
mtime=$(date -d "@${updated_on}")
git add .
export GIT_COMMITTER_DATE=$mtime
export GIT_AUTHOR_DATE=$mtime
if [ -n "$(git diff --staged)" ]; then
git commit --date "$mtime" -m "Updated on: $updated_on" && git push
fi