From 8717c67e9020b06e6904a3040c3eb81483ee1bbe Mon Sep 17 00:00:00 2001 From: Katherine Fairchild Date: Mon, 13 Nov 2023 14:58:16 -0500 Subject: [PATCH] only run git diff when TRAVIS_PULL_REQUEST_BRANCH is not empty --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e89328e7..d27dbb97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,9 @@ before_script: - git fetch --depth=50 origin refs/heads/main:refs/heads/main script: # if ONLY plugin files changed, ONLY run tests for those plugins; otherwise, run full test suite - - CHANGED_FILES=$( echo $(git diff --name-only main $TRAVIS_PULL_REQUEST_SHA -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) - | - if [ "$TRAVIS_PULL_REQUEST" ]; then + if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then + CHANGED_FILES=$( git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch && echo $(git diff --name-only origin/$TRAVIS_PULL_REQUEST_BRANCH origin/$TRAVIS_BRANCH -C $TRAVIS_BUILD_DIR) | tr '\n' ' ' ) && TESTING_NEEDED=$( python -c "from brainscore_core.plugin_management.parse_plugin_changes import get_testing_info; get_testing_info(\"${CHANGED_FILES}\", 'brainscore_language')" ) && read MODIFIES_PLUGIN PLUGIN_ONLY <<< $TESTING_NEEDED && echo MODIFIES_PLUGIN: $MODIFIES_PLUGIN && echo PLUGIN_ONLY: $PLUGIN_ONLY; fi