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.
Ingvar Stepanyan committed
Sep 5, 2014 at 15:45 UTC
3b2cd51fa50d15016d3dc2ea2582e86961db973b
1 file changed
+2
-1
.travis.yml
+2
-1
@@ -8,7 +8,8 @@ cache:
8
before_install:
9
- |
10
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
11
- TRAVIS_COMMIT_RANGE="FETCH_HEAD...$TRAVIS_BRANCH"
11
+ 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')
12
+ TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
13
fi
14
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' || {
15
echo "Only docs were updated, stopping build process."