-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (55 loc) · 1.76 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
56
57
58
59
60
61
62
63
64
65
66
name: Update open house data
concurrency: scrape
on:
schedule:
- cron: '0 */5 * * *'
workflow_dispatch:
jobs:
scrape-and-commit:
runs-on: ubuntu-latest
environment: scrape
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Scrape and commit
env:
OH_SESSION_COOKIE: ${{ secrets.OH_SESSION_COOKIE }}
run: |
sudo apt-get install libgeos-dev
pip install -r requirements.txt
# we'll regenerate these, so remove them now and git add -u will
# later mark them as deleted in git
rm data/2023/* || true
rm csv/2023/* || true
rm -rf maps/2023/* || true
python -u scrape-openhouse.py
python -u generate-csv-summary.py
python -u generate-maps.py
mv data data.new
mv csv csv.new
mv maps maps.new
git checkout -- data
git checkout -- csv
git checkout -- maps
git pull --ff-only
rm -rf data
rm -rf csv
rm -rf maps
mv data.new data
mv csv.new csv
mv maps.new maps
# -u because we want to also remove any files that have been deleted
git add data
git add csv
git add maps
git config --global user.email "bot@jonty.co.uk"
git config --global user.name "OH London update GHA"
# || true means this won't error when there's nothing to commit
git commit -m "Automatic OH London data update" || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}