-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.17 KB
/
update-data.yml
File metadata and controls
46 lines (43 loc) · 1.17 KB
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
42
43
44
45
46
name: Update eBird Data
on:
schedule:
- cron: "0 0 15-31 10 *"
workflow_dispatch:
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run update script
env:
EBIRD_API_KEY: ${{ secrets.EBIRD_API_KEY }}
run: |
python update_species.py
- name: Validate JSON files
run: |
valid=true
for file in json/*.json; do
if [ $(jq '. | length' "$file") -lt 2 ]; then
echo "Error: $file has fewer than 2 elements"
valid=false
break
fi
done
if [ "$valid" = false ]; then
echo "JSON validation failed. Aborting commit."
exit 1
fi
- name: Commit and push if changed and valid
run: |
git config --global user.email "minsiansu@gmail.com"
git config --global user.name "siansiansu"
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Auto update data"
git push
fi