commit-msg 745 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. #ident "@(#)$Format:LocalFoodAI:app.py:%an:%ae:%ad:%cn:%ce:%cd:%H:%D:%N$"
  3. commit_msg_file="$1"
  4. commit_msg=$(cat "$commit_msg_file")
  5. # Skip checking merge commits or empty commits
  6. if echo "$commit_msg" | grep -qE "^Merge "; then
  7. exit 0
  8. fi
  9. # Regex pattern to check if the commit message starts with TG-<num>, US#<num>, or [#<num>]
  10. if echo "$commit_msg" | grep -qE "^(TG-[0-9]+|US#[0-9]+|\[#[0-9]+\])"; then
  11. exit 0
  12. else
  13. echo "❌ Error: Commit message must start with a Taiga task/story tag (e.g., TG-123, US#123, or [#123])."
  14. echo "Your commit message was:"
  15. echo "--------------------------------------------------"
  16. echo "$commit_msg"
  17. echo "--------------------------------------------------"
  18. exit 1
  19. fi