trigger-website.sh 606 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh
  2. set -eu
  3. TOKEN=$1
  4. MSG_SUFFIX=${2:-''}
  5. if [ -n "$MSG_SUFFIX" ]
  6. then
  7. MSG_SUFFIX=" for ${MSG_SUFFIX}"
  8. fi
  9. REPO=$(echo "PHP-CS-Fixer/PHP-CS-Fixer.github.io" | sed "s@/@%2F@g")
  10. body="{
  11. \"request\": {
  12. \"branch\": \"generate\",
  13. \"message\": \"Build triggered automatically${MSG_SUFFIX}\"
  14. }
  15. }"
  16. curl -s -X POST \
  17. -H "Content-Type: application/json" \
  18. -H "Accept: application/json" \
  19. -H "Travis-API-Version: 3" \
  20. -H "User-Agent: API Explorer" \
  21. -H "Authorization: token ${TOKEN}" \
  22. -d "${body}" \
  23. "https://api.travis-ci.org/repo/${REPO}/requests"