Skip to content

update data

update data #60

Workflow file for this run

name: update data
on:
schedule:
# At 08:00 on every Monday
- cron: '0 8 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check if it's the second Monday of the month or manual trigger
id: check_second_monday
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] || \
([[ $(date +'%d') -gt 7 && $(date +'%d') -lt 15 ]] && [[ $(date +'%u') -eq 1 ]]); then
echo "Running jobs."
echo "RUN_JOBS=true" >> $GITHUB_ENV
else
echo "Skipping jobs."
echo "RUN_JOBS=false" >> $GITHUB_ENV
fi
shell: bash
- uses: actions/checkout@v3
if: env.RUN_JOBS == 'true'
- uses: actions/setup-python@v4
if: env.RUN_JOBS == 'true'
with:
python-version: '3.10'
- name: setup
if: env.RUN_JOBS == 'true'
run: |
sudo apt install aria2 osmium-tool pv
pip install -r requirements.txt
- name: download latest changeset
if: env.RUN_JOBS == 'true'
run: |
wget -N https://planet.openstreetmap.org/planet/changesets-latest.osm.bz2.torrent
aria2c --seed-time 0 --check-integrity changesets-latest.osm.bz2.torrent
- name: save compressed changeset csv
if: env.RUN_JOBS == 'true'
run: osmium cat --output-format opl $(ls *.osm.bz2) | python3 src/changeset_to_parquet.py temp
- name: save data
if: env.RUN_JOBS == 'true'
run: python3 src/parquet_to_json_stats.py temp
- name: save notebooks and data
if: env.RUN_JOBS == 'true'
run: for notebook in $(find src/questions -name calculations.ipynb); do jupyter nbconvert --to notebook --execute "$notebook" --output calculations.ipynb; done
- name: Create Pull Request
if: env.RUN_JOBS == 'true'
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
assets/*
src/questions/*
commit-message: data update
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
delete-branch: true
title: 'data update'
body: 'update plots and tables with the latest changeset'