Refetch inspections list by letter #637
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |