Skip to content

Instantly share code, notes, and snippets.

@thinhdanggroup
Created March 13, 2020 10:22
Show Gist options
  • Save thinhdanggroup/6069f591d0ce034474f162ba6e0f0be6 to your computer and use it in GitHub Desktop.
Save thinhdanggroup/6069f591d0ce034474f162ba6e0f0be6 to your computer and use it in GitHub Desktop.
#!/bin/sh
error_msg="Aborting commit. Your commit must:
[SCOPE - which part of the source code is impacted]: <Short (72 chars or less) summary>
<The body, details explain what's this commit does?>
Issues: <Jira issue link>"
msg=$(cat $1)
regex="^\[.{1,30}\].{1,250}\n\n.{1,250}(\n\nIssues:.{0,20})?"
echo
echo =====ZAS Checker=====
echo Message:
echo $msg
echo =====================
numOK=$(pcregrep -nMc "$regex" "$1")
error=0
if [ $numOK -eq 0 ];
then
echo "$error_msg" >&2
echo =====================
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment