-
-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (38 loc) · 1.2 KB
/
scrape.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
name: Scrape latest data
on:
push:
workflow_dispatch:
schedule:
- cron: '23 2,14 * * *' # twice a day
- cron: '38 7 * * 0' # once a week on Sunday
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Check out this repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r requirements.txt
- name: Fetch latest data and stats once a week OR on workflow_dispatch
if: |-
github.event_name == 'workflow_dispatch' || (
github.event_name == 'schedule' && github.event.schedule == '38 7 * * 0'
)
run: python scrape_socrata.py socrata/ --stats
- name: Fetch data without stats twice a day
if: |-
github.event_name == 'schedule' && github.event.schedule == '23 2,14 * * *'
run: python scrape_socrata.py socrata/
- name: Commit and push if it changed
run: |-
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
git push