codespell.sh 381 B

12345678910111213141516
  1. #!/bin/sh
  2. set -e
  3. result=0
  4. echo "Running codespell on source code..."
  5. codespell || result=1
  6. if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
  7. for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
  8. echo "Running codespell on commit message of $COMMIT..."
  9. git show --format=%B -s "$COMMIT" | codespell - || result=1
  10. done
  11. fi
  12. exit $result