chore: add sampling of CSV #29
Workflow file for this run
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: Provider Map Jobs | |
on: | |
push: | |
branches: | |
- vlad/bq-testing | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
fetch_warehouse: | |
name: Fetch Warehouse Updates | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Authenticate with Google | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Download providers.csv from warehouse | |
run: | | |
# Log what version of the BigQuery CLI we're using | |
bq version | |
# Download the latest providers.csv from the warehouse | |
bq query \ | |
--quiet \ | |
--headless \ | |
--format=csv \ | |
--use_legacy_sql=false \ | |
--max_rows=500 \ | |
"SELECT * FROM \`mart_transit_database.dim_mobility_mart_providers\`" \ | |
> src/metadata/providers/providers.csv | |
# Sample our CSV to make sure it's good | |
head -50 src/metadata/providers/providers.csv | |
- name: Fix our CSV file | |
run: | | |
# Workaround because of... | |
# https://issuetracker.google.com/issues/315160970 | |
sed -i -n -e '/agency_name/,$p' src/metadata/providers/providers.csv | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies, process providers, and update GeoJSON | |
run: | | |
pip install -r .github/resources/requirements.txt | |
python .github/resources/process_providers.py | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
title: Provider Map Data Auto Update | |
body: | | |
It's that time again! The warehouse has delivered new data for us to use. This is an automatic pull request created by the `provider-map-jobs.yml` workflow; it is triggered via a cron that runs every Sunday at midnight UTC. | |
commit-message: "chore: auto-update provider data from warehouse" | |
add-paths: | | |
src/metadata/providers/providers.csv | |
src/metadata/providers/counties.geojson | |
base: main |