Skip to content

Update Database

Update Database #3

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Update Database
concurrency:
group: database-build
# Controls when the action will run.
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '15 10 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# Add "id-token" with the intended permissions.
permissions:
contents: 'write'
id-token: 'write'
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
HEROKU_ORGANIZATION: ${{ secrets.HEROKU_ORG }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: dependencies
run: |
pip install sqlite-utils
pip install https://github.com/fgregg/datasette/archive/refs/heads/no_limit_csv_publish.zip
npm install -g heroku
- name: get databases
run: |
wget https://github.com/datamade/chicago-council-scrapers/releases/download/nightly/chicago_council.db.zip
unzip chicago_council.db.zip
rm chicago_council.db.zip
sqlite-utils create-index chicago_council.db bill -- -created_at
sqlite-utils create-index chicago_council.db billaction -- -date
sqlite-utils create-index chicago_council.db event -- -start_date
sqlite-utils create-index chicago_council.db voteevent -- -start_date
wget https://github.com/fgregg/ilcampaigncash/releases/download/nightly/il_campaign_disclosure.db.zip
unzip il_campaign_disclosure.db.zip
rm il_campaign_disclosure.db.zip
cat scripts/make_donation.sql | sqlite3 il_campaign_disclosure.db
sqlite-utils create-index il_campaign_disclosure.db receipts committee_id
sqlite-utils create-index il_campaign_disclosure.db receipts filed_doc_id
sqlite-utils create-index il_campaign_disclosure.db expenditures committee_id
sqlite-utils create-index il_campaign_disclosure.db expenditures filed_doc_id
sqlite-utils create-index il_campaign_disclosure.db d2_reports committee_id
sqlite-utils create-index il_campaign_disclosure.db d2_reports filed_doc_id
sqlite-utils create-index il_campaign_disclosure.db filed_docs committee_id
sqlite-utils create-index il_campaign_disclosure.db donation amount
sqlite-utils create-index il_campaign_disclosure.db donation received_date
sqlite-utils analyze il_campaign_disclosure.db
wget https://github.com/fgregg/cmap-legistar/releases/download/nightly/cmap.db.zip
unzip cmap.db.zip
rm cmap.db.zip
- name: Install heroku-builds plugin
run: |
heroku plugins:install heroku-builds
- name: Login to Heroku CLI
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ""
heroku_email: ${{ secrets.HEROKU_EMAIL }}
justlogin: true
- name: Deploy Datasette instance to Heroku
run: |
datasette publish heroku *.db \
-n puddle-datamade \
-m metadata.yml \
--extra-options="--crossdb --setting sql_time_limit_ms 100000 --cors --setting facet_time_limit_ms 500 --setting allow_facet off --setting trace_debug 1" \
--extra-options="--setting sql_time_limit_ms 60000" \
--install=datasette-atom \
--install=datasette-rure \
--install=pysqlite3-binary \
--install=datasette-hashed-urls \
--install=datasette-block-robots \
--install=datasette-pretty-traces \
--install datasette-datatable
- name: keepalive
uses: gautamkrishnar/[email protected]