Skip to content

Instantly share code, notes, and snippets.

@Aricg
Last active August 29, 2015 14:16
Show Gist options
  • Save Aricg/9c816b784edfdb65b35f to your computer and use it in GitHub Desktop.
Save Aricg/9c816b784edfdb65b35f to your computer and use it in GitHub Desktop.
ref-update enforcement hook for jira issue
#!/bin/bash
ref="$(awk -F'newrev' '{print $2}' <<< "$@" | xargs)"
log="$(git log --format=%s%b -n 1 "$ref")"
if grep -iq "JIRA:*[0-9]*" <<< "$log"
then
:
else
echo "Commit rejected, please provide a jira issue in the format JIRA: ISSUE_NUMBER in the commit message"
exit 1
fi
if grep -iq "SecurityImpact" <<< "$log"
then
echo "$log" | /bin/mail -s "Security Impact Detected" [email protected]
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment