-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (74 loc) · 2.42 KB
/
scrape.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: "Scrape"
on:
workflow_dispatch:
schedule:
- cron: "0 18 * * *"
jobs:
scrape:
name: Scrape
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: Refresh inspection list
run: python scripts/01-refresh-inspection-list.py
- name: Download inspection PDFs
run: python scripts/02-download-inspection-pdfs.py
- name: Parse inspection PDFs
run: python scripts/03-parse-inspection-pdfs.py
- name: Upload inspection PDFs to DocumentCloud
run: python scripts/04-upload-inspection-pdfs.py
env:
DOCUMENTCLOUD_PROJECT_ID: 211004
DOCUMENTCLOUD_USER: ${{ secrets.DOCUMENTCLOUD_USER }}
DOCUMENTCLOUD_PASSWORD: ${{ secrets.DOCUMENTCLOUD_PASSWORD }}
- name: Combine data obtained in the previous steps
run: python scripts/05-combine-inspection-data.py
- name: Update RSS
run: python scripts/06-update-rss.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 pdfs && (git diff --cached --quiet || git commit -m "Fetch newly available reports")
- name: Push changes
run: git push
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: data/combined
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: scrape
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
name: Deploy data to GitHub Pages
uses: actions/[email protected]
mirror:
name: Mirror
runs-on: ubuntu-latest
needs: scrape
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch latest commit
run: git pull origin main
- name: Upload inspections CSV to biglocalnews.org
uses: biglocalnews/upload-files@v2
with:
api-key: ${{ secrets.BLN_API_KEY }}
project-id: ${{ secrets.BLN_PROJECT_ID }}
path: ./data/combined/