diff --git a/.github/workflows/dbt_docs_updates.yml b/.github/workflows/dbt_docs_updates.yml index f8804db..36e7986 100644 --- a/.github/workflows/dbt_docs_updates.yml +++ b/.github/workflows/dbt_docs_updates.yml @@ -1,24 +1,32 @@ name: docs_update on: - workflow_call: + push: + branches: + - "main" + env: - ACCOUNT: "${{ secrets.ACCOUNT }}" - ROLE: "${{ secrets.ROLE }}" - USER: "${{ secrets.USER }}" + 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: "${{ secrets.REGION }}" - DATABASE_DEV: "${{ secrets.DATABASE_DEV }}" - DATABASE_PROD: "${{ secrets.DATABASE_PROD }}" - WAREHOUSE_DEV: "${{ secrets.WAREHOUSE_DEV }}" - WAREHOUSE_PROD: "${{ secrets.WAREHOUSE_PROD }}" - SCHEMA: "${{ secrets.SCHEMA }}" + REGION: "${{ vars.REGION }}" + DATABASE: "${{ vars.DATABASE }}" + WAREHOUSE: "${{ vars.WAREHOUSE }}" + SCHEMA: "${{ vars.SCHEMA }}" + + jobs: scheduled_run: name: docs_update runs-on: ubuntu-latest + environment: + name: workflow_prod steps: - uses: actions/checkout@v3 @@ -29,7 +37,7 @@ jobs: - name: install dependencies run: | - pip install dbt-snowflake + pip install dbt-snowflake==${{ vars.DBT_VERSION }} dbt deps - name: checkout docs branch @@ -59,4 +67,8 @@ jobs: git commit -am "Auto-update docs" - name: push changes to docs run: | - git push -f --set-upstream origin docs \ No newline at end of file + git push -f --set-upstream origin docs + + - name: refresh ddl for datashare + run: | + cnt=$(dbt ls -m fsc_utils.datashare._datashare___create_gold | wc -l ); if [ $cnt -eq 1 ]; then dbt run -m fsc_utils.datashare._datashare___create_gold; fi; \ No newline at end of file