name: dbt_run_streamline_blocks_txcount_realtime
run-name: dbt_run_streamline_blocks_txcount_realtime

on:
  workflow_dispatch:
  # schedule:
  #   # Runs "at minute 25 and 55, every hour" (see https://crontab.guru)
  #   - cron: '0,30 * * * *'

env:
  DBT_PROFILES_DIR: ./

  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:
  run_dbt_jobs:
    runs-on: ubuntu-latest
    environment: 
      name: workflow_prod

    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-python@v4
        with:
          python-version: "${{ vars.PYTHON_VERSION }}"
          cache: "pip"

      - name: install dependencies
        run: |
          pip3 install dbt-snowflake==${{ vars.DBT_VERSION }} cli_passthrough requests click
          dbt deps
      - name: Run DBT Jobs
        run: |
         dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m 1+models/streamline/core/realtime/streamline__txcount_realtime.sql 1+models/streamline/core/realtime/streamline__blocks_realtime.sql