You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

  1. #!/bin/bash
  2. FORMAT_FILE=../README.md
  3. if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
  4. echo "running on $TRAVIS_BRANCH branch"
  5. LINK_FILE=../README.md
  6. else
  7. echo "running on Pull Request #$TRAVIS_PULL_REQUEST"
  8. DIFF_URL="https://patch-diff.githubusercontent.com/raw/toddmotto/public-apis/pull/$TRAVIS_PULL_REQUEST.diff"
  9. curl $DIFF_URL > diff.txt
  10. echo "------- BEGIN DIFF -------"
  11. cat diff.txt
  12. echo "-------- END DIFF --------"
  13. cat diff.txt | egrep "\+" > additions.txt
  14. echo "------ BEGIN ADDITIONS -----"
  15. cat additions.txt
  16. echo "------- END ADDITIONS ------"
  17. LINK_FILE=additions.txt
  18. fi
  19. echo "running format validation..."
  20. ./validate_format.rb $FORMAT_FILE > format_results.txt
  21. if [[ $? != 0 ]]; then
  22. echo "format validation failed!"
  23. cat format_results.txt | build_bot.py
  24. exit 1
  25. else
  26. echo "format validation passed!"
  27. fi
  28. echo "running link validation..."
  29. ./validate_links.rb $LINK_FILE
  30. if [[ $? != 0 ]]; then
  31. echo "link validation failed!"
  32. echo "link(s) were unavailible during the build. Please verfiy that they are valid." | build_bot.py
  33. exit 1
  34. else
  35. echo "link validation passed!"
  36. fi