-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upadte GHA config to assign dbt run to PR number
- Loading branch information
1 parent
61cf8dd
commit 4dc52b3
Showing
1 changed file
with
18 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,21 +5,30 @@ on: | |
push: | ||
branches-ignore: [ "main", "master"] | ||
|
||
env: | ||
TARGET_SCHEMA: dev | ||
|
||
jobs: | ||
validate_dbt_models: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: 8BitJonny/[email protected] | ||
id: PR | ||
|
||
- name: set var PR_schema | ||
run: echo "PR_schema=${var_schema}" >> $GITHUB_ENV | ||
if: steps.PR.outputs.pr_found == 'true' | ||
env: | ||
var_schema: '"schema_name": "ci_PR_${{ steps.PR.outputs.number }}"' | ||
|
||
|
||
- uses: actions/checkout@v3 | ||
|
||
- uses: ./.github/actions/setup-env | ||
with: | ||
PROD_ENV: ${{ secrets.PROD_ENV }} | ||
|
||
|
||
- name: Cache Python packages | ||
uses: actions/cache@v3 | ||
|
@@ -68,14 +77,16 @@ jobs: | |
run: npm install -g "@lightdash/cli@${{ steps.version.outputs.value }}" || npm install -g @lightdash/cli@latest | ||
|
||
|
||
- name: validate dbt models | ||
run: dbt build | ||
|
||
|
||
- name: dbt build models | ||
run: dbt build --target ci --vars "$PR_schema" | ||
|
||
|
||
- name: validate LD | ||
id: validate-lightdash | ||
run: lightdash validate --target ci --vars "$PR_schema" | ||
env: | ||
LIGHTDASH_API_KEY: ${{ secrets.LIGHTDASH_API_KEY }} | ||
LIGHTDASH_PROJECT: ${{ secrets.LIGHTDASH_PROJECT }} | ||
LIGHTDASH_URL: ${{ secrets.LIGHTDASH_URL }} | ||
run: lightdash validate | ||
LIGHTDASH_URL: ${{ secrets.LIGHTDASH_URL }} |