From 26a98aad04726f9edb76089cc72ac67082f01c4e Mon Sep 17 00:00:00 2001 From: Julius Remigio <14811322+juls858@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:45:23 -0700 Subject: [PATCH] - move env variables to called workflow (#41) --- .github/workflows/dbt.yml | 22 +++++++++++++++++++++- .github/workflows/dbt_test.yml | 15 ++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dbt.yml b/.github/workflows/dbt.yml index 0cadd2a..8b0fbaf 100644 --- a/.github/workflows/dbt.yml +++ b/.github/workflows/dbt.yml @@ -1,4 +1,4 @@ -name: Run dbt command +name: dbt on: workflow_call: inputs: @@ -16,11 +16,31 @@ on: type: string default: "3.10" +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 }}" + jobs: dbt: runs-on: ubuntu-latest env: + DBT_PROFILES_DIR: ./ + ACCOUNT: "${{ vars.ACCOUNT }}" + ROLE: "${{ vars.ROLE }}" + USER: "${{ vars.USER }}" + PASSWORD: "${{ secrets.PASSWORD }}" + REGION: "${{ vars.REGION }}" + DATABASE: "${{ vars.DATABASE }}" WAREHOUSE: ${{ inputs.warehouse }} + SCHEMA: "${{ vars.SCHEMA }}" environment: name: ${{ inputs.environment }} steps: diff --git a/.github/workflows/dbt_test.yml b/.github/workflows/dbt_test.yml index 3aab3ca..421dbea 100644 --- a/.github/workflows/dbt_test.yml +++ b/.github/workflows/dbt_test.yml @@ -23,19 +23,6 @@ on: # Runs “Daily at midnight GMT” (see https://crontab.guru) - cron: '0 0 * * *' - -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 }} @@ -43,6 +30,7 @@ jobs: scheduled_job: uses: ./.github/workflows/dbt.yml if: github.event_name == 'schedule' || github.event_name == 'push' + secrets: inherit with: warehouse: ${{ inputs.warehouse }} environment: workflow_${{ inputs.environment }} @@ -51,6 +39,7 @@ jobs: manual_job: uses: ./.github/workflows/dbt.yml if: github.event_name == 'workflow_dispatch' + secrets: inherit with: warehouse: ${{ inputs.warehouse }} environment: workflow_${{ inputs.environment }}