Skip to content

Feat/stats for verification #12

Feat/stats for verification

Feat/stats for verification #12

# .github/workflows/app.yaml
name: dbt "pre"-commit hooks (beta)
on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'scripts/**'
- 'Pipfile'
- '.gitignore'
- '.github/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
dbt-precommit-hooks:
runs-on: [ self-hosted, linux, spellbook ]
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: jitterbit/get-changed-files@v1
id: abc
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Set modfied and added files as arg
run: |
echo "FILES=$(echo ${{ steps.abc.outputs.added_modified }})" >> $GITHUB_ENV
- name: dbt dependencies
run: "dbt deps"
- name: dbt compile
run: "dbt compile"
- name: check schemas
run: |
test=$(dbt --quiet --no-print ls --select config.schema:no_schema --output path)
[[ -z "$test" ]] && { echo "Success: All models have a custom schema"; exit 0; } || { echo "Found models without custom schema:"; echo "$test"; exit 1; }
- uses: pre-commit/action@v3.0.0
# Apologies for the hideously long line. Tried to get the Action to respect a multiline if but no dice.
if: ${{ contains(steps.abc.outputs.added_modified, 'models') || contains(steps.abc.outputs.added_modified, 'test') || contains(steps.abc.outputs.added_modified, 'seeds') || contains(steps.abc.outputs.added_modified, 'macros')}}
with:
extra_args: "--hook-stage manual --files $FILES"