From 093d69f0f0992c61541ac233fc3bef5194abf0a9 Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Mon, 6 Mar 2017 22:31:43 +0200 Subject: [PATCH] ci(aio): only deploy a preview if the PR touched relevant files --- scripts/ci/deploy.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/ci/deploy.sh b/scripts/ci/deploy.sh index 31f6c77e9d..6ec84be967 100755 --- a/scripts/ci/deploy.sh +++ b/scripts/ci/deploy.sh @@ -53,7 +53,13 @@ case ${CI_MODE} in if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then # This is a PR: deploy a snapshot for previewing travisFoldStart "deploy.aio.pr-preview" - yarn run deploy-preview + # Only deploy if this PR has touched relevant files. + AIO_CHANGED_FILES_COUNT=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep ^aio/ | wc -l) + if [[ AIO_CHANGED_FILES_COUNT -eq 0 ]]; then + echo "Skipping deploy because this PR did not touch any files inside 'aio/'." + else + yarn run deploy-preview + fi travisFoldEnd "deploy.aio.pr-preview" else # This is upstream master: Deploy to staging