diff --git a/.gitea/workflows/update.yaml b/.gitea/workflows/update.yaml new file mode 100644 index 0000000..58bcecf --- /dev/null +++ b/.gitea/workflows/update.yaml @@ -0,0 +1,31 @@ +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: install jq + run: | + apt update + apt install jq -y + - name: update hitster gameset database + run: | + wget https://hitster.jumboplay.com/hitster-assets/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 }}" + updated_on=$(cat "./gameset_database.json" | jq -r ".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