-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-secrets is a local tool that every developer has to set up on their own working copy. Add it to the guide so new contributors don't forget. Initializes a new git repo if the current directory is not a git repo. Fixes #271.
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ dist | |
pack | ||
.BUILD_COMPLETED | ||
.local-npm | ||
.tools | ||
coverage | ||
.nyc_output | ||
.LAST_BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
mkdir -p .tools | ||
[[ ! -d .tools/git-secrets ]] && { | ||
echo "=============================================================================================" | ||
echo "Downloading git-secrets..." | ||
(cd .tools && git clone --depth 1 https://github.com/awslabs/git-secrets.git) | ||
} | ||
|
||
# As the name implies, git-secrets heavily depends on git: | ||
# | ||
# a) the config is stored and fetched using 'git config'. | ||
# b) the search is performed using 'git grep' (other search methods don't work | ||
# properly, see https://github.com/awslabs/git-secrets/issues/66) | ||
# | ||
# When we run in a CodeBuild build, we don't have a git repo, unfortunately. So | ||
# when that's the case, 'git init' one on the spot, add all files to it (which | ||
# because of the .gitignore will exclude dependencies and generated files) and | ||
# then call 'git-secrets' as usual. | ||
git rev-parse --git-dir > /dev/null 2>&1 || { | ||
git init --quiet | ||
git add -A . | ||
|
||
# AWS config needs to be added to this fresh repository's config | ||
.tools/git-secrets/git-secrets --register-aws | ||
} | ||
|
||
.tools/git-secrets/git-secrets --scan | ||
echo "git-secrets scan ok" |