Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

46 rader
1.2 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.py $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