Skip to content

Instantly share code, notes, and snippets.

@imnnquy
Created February 24, 2021 06:14
Show Gist options
  • Save imnnquy/b8aa854ff0cfca16c9a0346714a4d0d6 to your computer and use it in GitHub Desktop.
Save imnnquy/b8aa854ff0cfca16c9a0346714a4d0d6 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
path="$1"
message=$(cat "$path")
echo "$message"
# shellcheck disable=SC2039
if ! [[ $message =~ ^US([0-9]{5})(\s*)* ]]; then
printf '\n\e[1;31mERROR: Your commit message must contain User Story ID\e[0m\n\n'
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment