-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use offline sites.json if API is down
- Loading branch information
Showing
4 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Fetch JSON from API | ||
|
||
on: | ||
schedule: | ||
- cron: "0 * * * *" # Runs every 24 hours (adjust UTC if needed) | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
jobs: | ||
update-json: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fetch JSON | ||
run: | | ||
curl -sS https://smc-api.lodine.xyz/sites -o data/sites.json || echo "API is down, using last known copy" | ||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --quiet || echo "CHANGED=true" >> $GITHUB_ENV | ||
- name: Commit and push if changed | ||
if: env.CHANGED == 'true' | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add data/sites.json | ||
git commit -m "Update sites.json (Automated)" | ||
git push |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
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