name: dbt_run_incremental
run-name: dbt_run_incremental

on:
  workflow_dispatch:
  schedule:
    - cron: '20,50 * * * *'

env:
  USE_VARS: "${{ vars.USE_VARS }}"
  DBT_PROFILES_DIR: "${{ vars.DBT_PROFILES_DIR }}"
  DBT_VERSION: "${{ vars.DBT_VERSION }}"
  ACCOUNT: "${{ vars.ACCOUNT }}"
  ROLE: "${{ vars.ROLE }}"
  USER: "${{ vars.USER }}"
  PASSWORD: "${{ secrets.PASSWORD }}"
  REGION: "${{ vars.REGION }}"
  DATABASE: "${{ vars.DATABASE }}"
  WAREHOUSE: "${{ vars.WAREHOUSE }}"
  SCHEMA: "${{ vars.SCHEMA }}"

concurrency:
  group: ${{ github.workflow }}

jobs:
  called_workflow_template:
    uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_run_template.yml@main
    with:
      dbt_command: |
          dbt run-operation stage_external_sources --vars "ext_full_refresh: true"
          dbt run -s ./models --exclude models/silver/_observability  tag:balances  tag:daily
          dbt run-operation stage_external_sources --vars "ext_full_refresh: true"
      environment: workflow_prod
      warehouse: ${{ vars.WAREHOUSE }}
    secrets: inherit 

