Skip to content

Instantly share code, notes, and snippets.

@lucianmachado
Created April 9, 2020 08:54
Show Gist options
  • Save lucianmachado/459e3cbd39658406ecf530f35b00884f to your computer and use it in GitHub Desktop.
Save lucianmachado/459e3cbd39658406ecf530f35b00884f to your computer and use it in GitHub Desktop.
conventional commit hook bash
#!/bin/sh
COMMIT_MESSAGE=$(cat $1)
OUTPUT=$(echo $COMMIT_MESSAGE | awk '/^(build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(\!|\\\!)?: .*/');
if [[ ${#OUTPUT} -gt 0 ]]; then
exit 0;
else
echo "Mensagem de commit inválida. \n Consulte https://www.conventionalcommits.org/pt-br.";
exit 1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment