You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/tools/branch-name.sh

17 lines
330 B
Bash

#!/usr/bin/env sh
URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
BRANCH_NAME=`curl -s $URL ^/dev/null \
| grep -C 2 "head" \
| grep \"ref\" \
| cut -d':' -f2- \
| sed -e 's/["|,]//g;s/^[ \t]//g'
`
if [ -n "$BRANCH_NAME" ]; then
echo $BRANCH_NAME
else
echo $TRAVIS_BRANCH
fi