-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (55 loc) · 2.06 KB
/
update_data.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
56
57
58
59
60
61
62
63
64
65
66
67
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: Create Pull Request
if: env.RUN_JOBS == 'true'
uses: peter-evans/create-pull-request@v4
with:
add-paths: assets/*
commit-message: data update
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
delete-branch: true
title: 'data update'
body: 'update plots and tables with the latest changeset'