-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (33 loc) · 1.69 KB
/
update-geojson.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Update GeoJSON File
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
fetch-and-update-geojson:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch the entire history to avoid issues with rebase
# Step 2: Download the GeoJSON files from Google Drive
- name: Download GeoJSON files
run: |
curl -L -o data/aba_alert.geojson "https://drive.google.com/uc?export=download&id=${{ secrets.GDRIVE_FILE_ID_ABA_ALERT }}"
curl -L -o data/life_needs_alert.geojson "https://drive.google.com/uc?export=download&id=${{ secrets.GDRIVE_FILE_ID_LIFE_NEEDS_ALERT }}"
curl -L -o data/year_needs_alert.geojson "https://drive.google.com/uc?export=download&id=${{ secrets.GDRIVE_FILE_ID_YEAR_NEEDS_ALERT }}"
# Step 3: Commit and force push changes
- name: Commit and force push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
# Reset the branch to match the remote to avoid rebase errors
git fetch origin
git reset --soft origin/main # Retain changes but synchronize with remote
# Add and commit the downloaded files
git add data/aba_alert.geojson data/life_needs_alert.geojson data/year_needs_alert.geojson
git commit -m "Update GeoJSON files from Google Drive" || echo "No changes to commit"
# Force push to overwrite remote
git push --force origin main