Fetch latest map states as json #604
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: 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 |