Skip to content

Commit 8b1a504

Browse files
committed
chore(travis): read branch name correctly
1 parent e7d6282 commit 8b1a504

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

scripts/travis/ci.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ function run {
4040
# TODO Saucelabs settings need more tweaking before it becomes stable (sometimes it fails to connect)
4141
# grunt karma:sauce --reporters=dots
4242

43-
# NOTE(ajoslin): this is the only way I have found to reliably detect if we are on master.
44-
# `git rev-parse HEAD` changes to the name of a tag if we are pushing with a tag, as does TRAVIS_BRANCH.
45-
# `git branch` gives us back line-seperated list of all the branches, with a * beside
46-
# the active branch. So we grep the * then take out the spaces/asterisks and we have
47-
# branch name.
48-
GIT_BRANCH=$(git branch | grep '* ' | sed 's/ //g' | sed 's/\*//g')
43+
GIT_BRANCH=$(git symbolic-ref HEAD --short)
4944
if [[ "$GIT_BRANCH" != "master" ]]; then
5045
echo "-- We are not on branch master, we are on branch $GIT_BRANCH. Will not push build out."
5146
exit 0

0 commit comments

Comments
 (0)