Created
May 14, 2020 11:22
-
-
Save mwoodbri/c6dbb94c83e0b09b67ee6c61a58b1a75 to your computer and use it in GitHub Desktop.
Git hook that warns of non-https links in Markdown files
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
#!/bin/sh | |
FILES=$(git diff --cached --name-only --diff-filter=ACMR "*.md" | sed 's| |\\ |g') | |
test -z "$FILES" && exit 0 | |
URLS=$(echo "$FILES" | xargs egrep -o 'http://[^ )]+') | |
test -z "$URLS" && exit 0 | |
echo -e "\e[31mInsecure links:\e[0m\n$URLS" | |
#exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment