Skip to content

Run BigQuery Queries for Udash #368

Run BigQuery Queries for Udash

Run BigQuery Queries for Udash #368

name: Run BigQuery Queries for Udash
on:
workflow_dispatch:
schedule:
- cron: 0 12 * * *
jobs:
dry-run-queries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests pandas google-cloud-bigquery pyarrow google-analytics-data
- name: Authorize google cloud
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GOOGLE_ANALYTICS_API_SERVICE_ACCOUNT}}'
# Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`.
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: List SQL Files
run: |
find src/sql -type f -name "*.sql" > queries.txt
cat queries.txt
- name: Dry Run SQL Queries
run: |
while IFS= read -r query_file; do
echo "Running $query_file"
bq query --use_legacy_sql=false < "$query_file"
done < queries.txt