From 9ff2400d76a7ceb58b8d7a85549984e9bdba6e2d Mon Sep 17 00:00:00 2001 From: Mikhail Date: Wed, 29 Mar 2023 17:58:24 +0300 Subject: [PATCH] DROID-1065 Project | Tech | Add secrets push hook (#3041) --- .githooks/pre-push | 17 +++++++++++++++++ .pre-commit-config.yaml | 5 +++++ 2 files changed, 22 insertions(+) create mode 100755 .githooks/pre-push create mode 100644 .pre-commit-config.yaml diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 000000000..996f5883f --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +INSTALL_PYTHON=python3 +ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-push) +# end templated + +HERE="$(cd "$(dirname "$0")" && pwd)" +ARGS+=(--hook-dir "$HERE" -- "$@") + +if [ -x "$INSTALL_PYTHON" ]; then + exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" +elif command -v pre-commit > /dev/null; then + exec pre-commit "${ARGS[@]}" +else + echo '`pre-commit` not found. Please visit https://wiki.anytype.io/doc/mandatory-git-hooks-5rQt1Qyw7k ' 1>&2 + exit 1 +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..43f091d04 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/zricethezav/gitleaks + rev: v8.16.0 + hooks: + - id: gitleaks \ No newline at end of file