-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (45 loc) · 1.6 KB
/
fully-refetch.yaml
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
name: "Refetch inspections list by letter"
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * *"
jobs:
scrape:
name: Clear and refetch some by-letter files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Delete files from inspections-by-letter based on day of week
run: >
cd data/fetched/inspections-by-letter/;
if [ $(date +%u) -eq 1 ];
then rm a.csv b.csv c.csv;
elif [ $(date +%u) -eq 2 ];
then rm d.csv e.csv f.csv;
elif [ $(date +%u) -eq 3 ];
then rm g.csv h.csv i.csv j.csv;
elif [ $(date +%u) -eq 4 ];
then rm k.csv l.csv m.csv;
elif [ $(date +%u) -eq 5 ];
then rm n.csv o.csv p.csv;
elif [ $(date +%u) -eq 6 ];
then rm q.csv r.csv s.csv;
elif [ $(date +%u) -eq 7 ];
then rm t.csv u.csv v.csv w.csv x.csv y.csv z.csv;
fi;
- name: Fetch inspection list
run: python scripts/00-fetch-inspection-list.py
- name: Config git
run: git config --global user.email "[email protected]" && git config --global user.name "Automated"
- name: Commit changes
run: git add data && (git diff --cached --quiet || git commit -m "Fully refetch inspections list")
- name: Push changes
run: git push