Skip to content

Instantly share code, notes, and snippets.

@tuanchris
Last active August 21, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuanchris/4092e188d79707d65bfaaebdaf9b6e2d to your computer and use it in GitHub Desktop.
Save tuanchris/4092e188d79707d65bfaaebdaf9b6e2d to your computer and use it in GitHub Desktop.
name: pr_to_main
on:
pull_request:
branches:
- main
env:
DBT_PROFILES_DIR: ./
DBT_GOOGLE_PROJECT_DEV: ${{ secrets.DBT_GOOGLE_PROJECT_DEV }}
DBT_GOOGLE_BIGQUERY_DATASET_DEV: ${{ secrets.DBT_GOOGLE_BIGQUERY_DATASET_DEV }}
# The DBT_GOOGLE_BIGQUERY_KEYFILE_DEV secret will be written to a json file below
DBT_GOOGLE_BIGQUERY_KEYFILE_DEV: ./dbt-service-account.json
jobs:
pr_to_main:
name: pr_to_main
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@master
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: Authenticate using service account
run: 'echo "$KEYFILE" > ./dbt-service-account.json'
shell: bash
env:
KEYFILE: ${{secrets.DBT_GOOGLE_BIGQUERY_KEYFILE_DEV}}
- name: Install dependencies
run: |
pip install dbt
dbt deps
# Add dbt seed or other commands here if needed
- name: Run dbt models
run: dbt run
- name: Test dbt models
run: dbt test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment