Skip to content

Instantly share code, notes, and snippets.

@mwoodbri
Created May 14, 2020 11:22
Show Gist options
  • Save mwoodbri/c6dbb94c83e0b09b67ee6c61a58b1a75 to your computer and use it in GitHub Desktop.
Save mwoodbri/c6dbb94c83e0b09b67ee6c61a58b1a75 to your computer and use it in GitHub Desktop.
Git hook that warns of non-https links in Markdown files
#!/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