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

Feature/1900 - ensure git secrets is installed #2457

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions front-end/git-secrets-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

GIT_DIR=$(git rev-parse --git-dir)

set -e

break_installation() {
echo "
Developers need to have git secrets installed and configured properly.
See the README for more information.

Preventing installation...
"
rm -r node_modules
exit 1
}

# If the environment variable is present, then exit with a success
if [[ $IGNORE_GIT_SECRETS_CHECK ]]; then exit 0; fi

# If the git secrets command doesn't result in a man page, it isn't installed
if ! git secrets | grep -q "usage"
then
echo "Git secrets is not installed";
break_installation;
fi

# If the --list flag doesn't include any patterns, our pattern install script hasn't been run
if ! git secrets --list | grep -q "patterns"
then
echo "Git secrets has no installed patterns. Have you run the API repo's install script?";
break_installation;
fi

exit 0;
Loading