Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip functionality to "dbt-deps" hook #177

Open
daniel-bartley opened this issue Jan 25, 2024 · 0 comments
Open

Add skip functionality to "dbt-deps" hook #177

daniel-bartley opened this issue Jan 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@daniel-bartley
Copy link

daniel-bartley commented Jan 25, 2024

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.

@daniel-bartley daniel-bartley added the enhancement New feature or request label Jan 25, 2024
@daniel-bartley daniel-bartley changed the title Add skip functionality to "dbt-deps" hook SECDAI-17049 Add skip functionality to "dbt-deps" hook Jan 25, 2024
@daniel-bartley daniel-bartley changed the title SECDAI-17049 Add skip functionality to "dbt-deps" hook Add skip functionality to "dbt-deps" hook Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant