From f13ba86f9c2913138c432b95cdf9a06094aa03e0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sun, 8 Oct 2017 09:43:56 +0200 Subject: [PATCH] [ci] consider forked builds as pull requests forked builds are travis builds on forked repos --- .travis/common-functions.sh | 5 ++--- .travis/setup-secrets.sh | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis/common-functions.sh b/.travis/common-functions.sh index 6e9c9a8e26..34cf4c973c 100755 --- a/.travis/common-functions.sh +++ b/.travis/common-functions.sh @@ -11,9 +11,8 @@ echo "TRAVIS_BRANCH: $TRAVIS_BRANCH" echo "TRAVIS_TAG: $TRAVIS_TAG" echo "TRAVIS_ALLOW_FAILURE: $TRAVIS_ALLOW_FAILURE" - function travis_isPullRequest() { - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then return 0 else return 1 @@ -21,7 +20,7 @@ function travis_isPullRequest() { } function travis_isPush() { - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ]; then + if [ "${TRAVIS_REPO_SLUG}" = "pmd/pmd" && "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_SECURE_ENV_VARS}" = "true" ]; then return 0 else return 1 diff --git a/.travis/setup-secrets.sh b/.travis/setup-secrets.sh index a52143ea77..cb9cf28fdf 100755 --- a/.travis/setup-secrets.sh +++ b/.travis/setup-secrets.sh @@ -1,12 +1,11 @@ #!/bin/bash set -e -if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "${TRAVIS_SECURE_ENV_VARS}" != "true" ]; then - echo "Not setting up secrets (TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS})." +if [ "$TRAVIS_REPO_SLUG" != "pmd/pmd" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "${TRAVIS_SECURE_ENV_VARS}" != "true" ]; then + echo "Not setting up secrets (TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS})." exit 0 fi - openssl aes-256-cbc -K $encrypted_5630fbebf057_key -iv $encrypted_5630fbebf057_iv -in .travis/secrets.tar.enc -out .travis/secrets.tar -d pushd .travis && tar xfv secrets.tar && popd mkdir -p "$HOME/.ssh"