This repository has been archived by the owner on Aug 31, 2024. It is now read-only.
Update Game Patches #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Game Patches | |
on: | |
schedule: | |
- cron: '0 0,12 * * *' # Runs every 24 hours | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
update-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
game-patches.json | |
Database/game-patches.json | |
sparse-checkout-cone-mode: false | |
- name: Fetch JSON file | |
id: fetch-json | |
run: | | |
HTTP_STATUS=$(curl -o Database/game-patches.json -s -w "%{http_code}" https://api.github.com/repos/xenia-canary/game-patches/contents/patches) | |
if [ "$HTTP_STATUS" -ne 200 ]; then | |
echo "Failed to fetch JSON file: HTTP status $HTTP_STATUS" | |
exit 1 | |
fi | |
- name: Commit and push changes | |
if: success() # Only run if previous steps succeeded | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add Database/game-patches.json | |
git diff-index --quiet HEAD || git commit -m "Update game patches" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |