Run DBT (daily) #341
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: "Run DBT (daily)" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 12 * * *" # Every Day at noon | |
env: | |
DBT_PROFILES_DIR: . | |
DUCKDB_PATH: github_contributions.duckdb | |
PYTHON_VERSION: 3.9 | |
REINGEST_ALL: false # set to true to mimic a --full-refresh | |
jobs: | |
dbt: | |
runs-on: self-hosted | |
timeout-minutes: 10080 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install dbt-duckdb==1.7.2 github_contributions/ | |
dbt deps | |
- name: Download duckdb # retrieves .duckdb file from last successful run (last day in happy scenario) | |
if: ${{ env.REINGEST_ALL != 'true' }} | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
name: ${{ env.DUCKDB_PATH }} | |
workflow: dbt.yml | |
workflow_conclusion: success | |
continue-on-error: true | |
- name: dbt build | |
run: dbt build --fail-fast | |
- name: Upload duckdb for Debugging | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: github_contributions_debug_${{ github.run_id }}.duckdb | |
path: ${{ env.DUCKDB_PATH }} | |
# CHANGE WITH CAUSION!!! | |
# The retention days determines how long it takes for author data to be | |
# forgotten | |
retention-days: 2 | |
- name: Upload duckdb | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: github_contributions.duckdb | |
path: ${{ env.DUCKDB_PATH }} | |
# CHANGE WITH CAUSION!!! | |
# The retention days determines how long it takes for author data to be | |
# forgotten | |
retention-days: 15 |