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

Support for git hooks #6

Open
christianwiedemann opened this issue Oct 17, 2020 · 1 comment
Open

Support for git hooks #6

christianwiedemann opened this issue Oct 17, 2020 · 1 comment

Comments

@christianwiedemann
Copy link

Hi again,

BLT uses git hooks to validate templates / php etc. These hooks are using PHP. So it would be great to pass the scripts to docksal CLI container.
For example the pre commit hook could work like this:

#!/usr/bin/env bash


ROOT_DIR="$(pwd)/"
LIST=$( git diff --name-only --cached --diff-filter=ACM )

echo "Executing .git/hooks/pre-commit..."
git diff-index --quiet HEAD -- || echo "Untracked files are present, this may impact the validity of pre-commit checks."
fin exec /var/www/vendor/bin/blt internal:git-hook:execute:pre-commit "${LIST}"

# Return the status of the last run command.
exit $?

I could open a pull with these updated scripts and an updated local.blt.setting which points to the script:

git:
  hooks:
    pre-commit: ${repo.root}/vendor/docksal/docksal-blt/git-hooks
    pre-push: ${repo.root}/vendor/docksal/docksal-blt/git-hooks
    commit-msg: ${repo.root}/vendor/docksal/docksal-blt/git-hooks

What do you think? And thanks for your work.

@shelane
Copy link
Member

shelane commented Nov 24, 2021

@christianwiedemann This sounds like a great idea. I'd love to give it a try. Do you still want to do a PR for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants