#!/usr/bin/env bash
# Secret scan of the staged changes. `git config core.hooksPath .githooks`
# turns it on per clone (README.md, Try it).
# Without gitleaks it warns and lets the commit through: CI checks again.
PATH="$PATH:$HOME/bin"
if ! command -v gitleaks >/dev/null 2>&1; then
  echo "pre-commit: gitleaks not found; install it (https://github.com/gitleaks/gitleaks/releases) to scan commits before they leave this machine" >&2
  exit 0
fi
exec gitleaks git --pre-commit --staged --redact --no-banner --verbose
