From 20490d53fc9c00b28c7e91535341daafec506f52 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 7 Oct 2020 02:46:13 -0500 Subject: [PATCH] fix commit ranges, attempt #2 --- ci/linkcheck.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ci/linkcheck.sh b/ci/linkcheck.sh index 5dab9eb2f..cba72ddc9 100755 --- a/ci/linkcheck.sh +++ b/ci/linkcheck.sh @@ -1,14 +1,20 @@ #!/usr/bin/env bash -if [ "$TRAVIS_EVENT_TYPE" = "cron" ] ; then +if [ "$TRAVIS_EVENT_TYPE" = "cron" ] ; then # running in cron job FLAGS="" echo "Doing full link check." -else - CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r origin/master... | tr '\n' ' ') +elif [ "$CI" = "true" ] ; then # running in PR CI build + CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r $TRAVIS_COMMIT_RANGE | tr '\n' ' ') FLAGS="-f $CHANGED_FILES" - echo "Checking files changed in origin/master...: $CHANGED_FILES" + echo "Checking files changed in $TRAVIS_COMMIT_RANGE: $CHANGED_FILES" +else # running locally + COMMIT_RANGE=master.. + CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r $COMMIT_RANGE | tr '\n' ' ') + FLAGS="-f $CHANGED_FILES" + + echo "Checking files changed in $COMMIT_RANGE: $CHANGED_FILES" fi exec mdbook-linkcheck $FLAGS -- $TRAVIS_BUILD_DIR