ci: Fix another branch name issue

This commit is contained in:
Emmanuel Lepage Vallée 2021-10-04 14:24:17 -07:00 committed by GitHub
parent 3807ed83b0
commit 46ae927951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ cd build/apidoc
# This will re-use already existing branches (updated PR). # This will re-use already existing branches (updated PR).
if [ "$PR_NUMBER" != "" ]; then if [ "$PR_NUMBER" != "" ]; then
BRANCH="pr-$PR_NUMBER" BRANCH="pr-$PR_NUMBER"
elif [ "$GITHUB_HEAD_REF" != master ]; then elif ["$GITHUB_HEAD_REF" != "" ] && [ "$GITHUB_HEAD_REF" != master ]; then
# Use merge-base of master in branch name, to keep different branches with # Use merge-base of master in branch name, to keep different branches with
# the same name apart. # the same name apart.
# shellcheck disable=SC2015 # shellcheck disable=SC2015
@ -48,7 +48,7 @@ elif [ "$GITHUB_HEAD_REF" != master ]; then
&& git fetch --unshallow origin master \ && git fetch --unshallow origin master \
&& git rev-parse --short "$(git merge-base HEAD FETCH_HEAD || true)" || true)" && git rev-parse --short "$(git merge-base HEAD FETCH_HEAD || true)" || true)"
else else
BRANCH="gh-pages" BRANCH="gh-pages"
fi fi
if [ "$BRANCH" != "gh-pages" ]; then if [ "$BRANCH" != "gh-pages" ]; then
git checkout -b "$BRANCH" "origin/${BRANCH}" 2> /dev/null || git checkout -b "$BRANCH" git checkout -b "$BRANCH" "origin/${BRANCH}" 2> /dev/null || git checkout -b "$BRANCH"