dbt-checkpoint
dbt-checkpoint copied to clipboard
Add skip functionality to "dbt-deps" hook
Describe the feature you'd like
dbt-deps is slow and never skips. :(
dbt-deps should optionally skip if:
- packages.yml is same as main
- $DBT_PATH_TO_PACKAGES exists and is not empty
- repo: local
hooks:
- id: dbt-deps
name: dbt deps if needed
entry: |
bash -c \
'DBT_PATH_TO_PACKAGES="$PATH_TO_DBT"/"$DBT_PACKAGES_DIR"
dbt_packages_installed="$(find "$DBT_PATH_TO_PACKAGES" -maxdepth 2 -type f | wc --lines)"
packages_yml_changed=$(git diff --name-only --cached | grep --count $"PATH_TO_DBT"/packages.yml)
if [ "$dbt_packages_installed" -eq 0 ] || [ "$packages_yml_changed" -eq 1 ] || [ ! -d "$DBT_PATH_TO_PACKAGES" ];
then dbt deps
else echo skip dbt deps
fi'
language: system
Happy to help but do not currently understand why skipping doesn't work for this command.