您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

55 行
1.3 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. echo "checking if /json was changed..."
  19. if egrep "\+{3}\s.\/json\/" diff.txt > json.txt; then
  20. echo "JSON files are auto-generated! Please do not update these files:"
  21. cat json.txt
  22. exit 1
  23. else
  24. echo "/json check passed!"
  25. rm json.txt
  26. fi
  27. fi
  28. echo "running format validation..."
  29. ./validate_format.rb $FORMAT_FILE
  30. if [[ $? != 0 ]]; then
  31. echo "format validation failed!"
  32. exit 1
  33. else
  34. echo "format validation passed!"
  35. ./build.sh && ./deploy.sh
  36. if [[ $? != 0 ]]; then
  37. echo "JSON build and deploy failed!"
  38. else
  39. echo "JSON build and deploy success!"
  40. fi
  41. fi
  42. echo "running link validation..."
  43. ./validate_links.rb $LINK_FILE
  44. if [[ $? != 0 ]]; then
  45. echo "link validation failed!"
  46. exit 1
  47. else
  48. echo "link validation passed!"
  49. fi