commit-msg 731 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. #
  3. # An example hook script to check the commit log message.
  4. # Called by "git commit" with one argument, the name of the file
  5. # that has the commit message. The hook should exit with non-zero
  6. # status after issuing an appropriate message if it wants to stop the
  7. # commit. The hook is allowed to edit the commit message file.
  8. echo "Running the AppFlowy commit-msg hook."
  9. # This example catches duplicate Signed-off-by lines.
  10. test "" = "$(grep '^Signed-off-by: ' "$1" |
  11. sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
  12. echo >&2 Duplicate Signed-off-by lines.
  13. exit 1
  14. }
  15. npx --no -- commitlint --edit $1
  16. if [ $? -ne 0 ]
  17. then
  18. echo "Please fix your commit message to match AppFlowy coding standards"
  19. exit 1
  20. fi