Skip to content

Instantly share code, notes, and snippets.

@bilzard
Last active April 9, 2019 16:21
Show Gist options
  • Save bilzard/56eaf032d960283303b52446cddddc69 to your computer and use it in GitHub Desktop.
Save bilzard/56eaf032d960283303b52446cddddc69 to your computer and use it in GitHub Desktop.
aws_iam_policy_attachment を含む commit を reject する pre-commit hook
#!/bin/sh
TABOO_WORD=aws_iam_policy_attachment
# 最新のコミットとの差分を比較し、タブー語を追加差分に含む場合は reject する
git diff HEAD -U0 "*.tf" | grep '^+' | grep -v '^++' | grep "$TABOO_WORD" 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
echo "[pre-commit FAILED..] 🔥 $TABOO_WORD は見つけ次第撲滅します!!!🔥"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment