1
0
mirror of https://github.com/ru-de/faq.git synced 2024-11-09 20:21:01 +00:00

additional checks for rate limit

This commit is contained in:
Evgeniy Sokolov 2018-08-08 22:14:29 +02:00
parent 5a87152cc3
commit f60da92d65

View File

@ -12,6 +12,12 @@ git config --global core.quotepath false
git diff HEAD^ --name-status | grep "^D" -v | sed 's/^.\t//g' | grep "\.md$" > /tmp/changed_files
curl -sH "Accept: application/vnd.github.v3.diff.json" https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST > /tmp/pr.diff
if [ "$?" != "0" ]; then
echo "Can't get github pull request diff, probably rate limit? Try to restart CI build"
exit 1
fi
cat /tmp/pr.diff | diff_liner > /tmp/pr_liner.json
rm -f /tmp/comments.json
@ -41,6 +47,11 @@ EXIT_CODE=0
if [ "$(cat /tmp/comments_array.json)" != "[]" ]; then
curl -s https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST/comments > /tmp/pr_comments.json
if [ "$?" != "0" ]; then
echo "Can't get github comments, probably rate limit? Try to restart ci build"
exit 1
fi
github_comments_diff -comments /tmp/comments_array.json -exists-comments /tmp/pr_comments.json > /tmp/send_comments.json
curl -XPOST "https://github-api-bot.herokuapp.com/send_review?repo=$TRAVIS_REPO_SLUG&pr=$TRAVIS_PULL_REQUEST&body=Спасибо%20за%20PR.%20Обратите%20внимание%20на%20результаты%20автоматической%20проверки%20орфографии%20и%20ссылок" -d @/tmp/send_comments.json