-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (46 loc) · 1.38 KB
/
update.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Fetch latest map states as json
permissions:
contents: write
# packages: write
# Controls when the action will run.
on:
workflow_dispatch:
schedule:
# Every day at '02:22'
# "Random" value to ensure it doesn't collide with peak scheduling hours
- cron: '22 2 * * *'
jobs:
fetch_map_and_commit:
runs-on: ubuntu-latest
env:
TZ: Europe/Paris
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install Python dependencies via pip
run: pip install -r requirements.txt
- name: Fetch latest map data via scrape.py
run: python scrape.py
- name: Recompute area via update_csv.py
run: python update_csv.py
- name: Commit files
run: |
git lfs install
git status
echo "Checking data on: `date`"
if [[ `git status --porcelain` ]]; then
echo "New update available"
git config --local user.name "actions-user"
git config --local user.email "[email protected]"
git add .
git commit -am "Automatic data update - $(date '+%Y-%m-%d %H:%M')"
git push origin master
else
echo "No changes to commit"
fi
shell: bash