Scrape latest data #925
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: Scrape latest data | |
on: | |
push: | |
push: | |
schedule: | |
- cron: "0 12 * * *" | |
workflow_dispatch: | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- | |
name: "Check out this repo" | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: scrape legislature reports | |
working-directory: . | |
run: | | |
cd wv-legislature && python agency_reports.py | |
- name: scrape crime log | |
working-directory: . | |
run: | | |
cd crime-log && python crime_log.py | |
- name: scrape meetings | |
working-directory: . | |
run: | | |
cd meeting-notices && python scraper.py | |
- name: scrape lobbying | |
working-directory: . | |
run: | | |
cd lobbying && python lobbying_filings.py 2023-2024 | |
- | |
name: "Commit and push if it changed" | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git pull | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push | |
- name: "build Datasette" | |
run: |- | |
rm wvu.db | |
sqlite-utils insert wvu.db crimelog crime-log/crime_log.csv --csv | |
- name: Fly setup | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: deploy | |
run: datasette publish fly wvu.db --app wvu-crime-log |