fix(travis): clean-up unusable push to github.io repo for prs

This commit is contained in:
actionless 2020-08-10 04:55:53 +02:00
parent 54c60679db
commit 4b7fe528fd
1 changed files with 2 additions and 15 deletions

View File

@ -44,23 +44,11 @@ addons:
# working copy to be there for updating already. # working copy to be there for updating already.
before_install: before_install:
- | - |
if [ -n "$GH_APIDOC_TOKEN" ]; then if [ -n "$GH_APIDOC_TOKEN" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then
set -e set -e
git clone \ git clone \
https://${GH_APIDOC_TOKEN}@github.com/awesomeWM/awesomeWM.github.io \ https://${GH_APIDOC_TOKEN}@github.com/awesomeWM/awesomeWM.github.io \
"$BUILD_WEB" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g" "$BUILD_WEB" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g"
if [ "$TRAVIS_PULL_REQUEST" = false ]; then
branch="$TRAVIS_BRANCH"
else
branch="pr-$TRAVIS_PULL_REQUEST"
fi
if [ "$branch" != master ]; then
cd $BUILD_WEB
if ! git checkout -b "$branch" "origin/$branch"; then
git checkout -b "$branch"
fi
cd -
fi
fi fi
install: install:
@ -87,8 +75,7 @@ script:
after_success: after_success:
- | - |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi if [ -n "$GH_APIDOC_TOKEN" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] ; then
if [ -n "$GH_APIDOC_TOKEN" ]; then
set -e set -e
commit_hash=$(git rev-parse --short HEAD) commit_hash=$(git rev-parse --short HEAD)
cd $BUILD_WEB cd $BUILD_WEB