Fix check for commit ranges in racing PRs.

See #1768 / #2000 for original issue.
See https://github.com/travis-ci/travis-ci/issues/1719#issuecomment-51705110 for problem description and origin of this fix.
This is still a temporary fix until travis-ci/travis-core#383 is merged.
This commit is contained in:
Ingvar Stepanyan
2014-09-05 15:45:21 +03:00
parent b36c9f6638
commit 3b2cd51fa5

View File

@@ -8,7 +8,8 @@ cache:
before_install:
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
TRAVIS_COMMIT_RANGE="FETCH_HEAD...$TRAVIS_BRANCH"
PR_FIRST=$(curl -s https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n')
TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
fi
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' || {
echo "Only docs were updated, stopping build process."