Skip to content

Commit

Permalink
fix os environment variable and update hook version
Browse files Browse the repository at this point in the history
  • Loading branch information
brady-gsa committed Feb 13, 2020
1 parent 6c3b8e7 commit a3f951c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/env sh

#!/bin/sh
# GITLEAKS_PRECOMMIT_HOOK BEGIN
precommit_version="v0.0.3"
precommit_latest_url=$(curl --silent --location --head --output /dev/null --write-out '%{url_effective}' -- https://github.com/GSA/odp-code-repository-commit-rules/releases/latest)
precommit_version=${precommit_latest_url##*/}
precommit_url="https://raw.githubusercontent.com/GSA/odp-code-repository-commit-rules/${precommit_version}/gitleaks/precommit.sh"
precommit_path="$(git rev-parse --show-toplevel)/.git/hooks/precommit.sh"

if [ ! -f "${precommit_path}" ]; then
curl --silent -o "${precommit_path}" "${precommit_url}"
if [ "$os" = "Linux" ] || [ "$os" = "Darwin" ]; then
chmod +x "${precommit_path}"
fi
curl --silent -o "${precommit_path}" "${precommit_url}"
os=$(uname -s | cut -d'_' -f 1)
if [ "$os" = "Linux" ] || [ "$os" = "Darwin" ]; then
chmod +x "${precommit_path}"
fi

"${precommit_path}" "${precommit_version}"
Expand Down

0 comments on commit a3f951c

Please sign in to comment.