IssueRaiser

Add a new environment variable which has the same value as `TRAVIS_BRANCH` or `TRAVIS_PULL_REQUEST_BRANCH` depending on the context

The addition of `$TRAVIS_PULL_REQUEST_BRANCH` from https://github.com/travis-ci/travis-ci/issues/1633 is nice, but it is still a bit difficult to get the name of the _current_ branch name from both PUSH and PR builds. The current workaround I have is this, which is not great: ``` export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) ``` Instead of having users script this, I suggest adding an environment variable `$TRAVIS_CURRENT_BRANCH`.

Posted by HelloGrayson on Sep 29, 2016, 7:03 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

ux (Software)

Add a new environment variable which has the same value as `TRAVIS_BRANCH` or `TRAVIS_PULL_REQUEST_BRANCH` depending on the context

HelloGraysonSep 29, 2016, 7:03 PM

The addition of `$TRAVIS_PULL_REQUEST_BRANCH` from https://github.com/travis-ci/travis-ci/issues/1633 is nice, but it is still a bit difficult to get the name of the _current_ branch name from both PUSH and PR builds. The current workaround I have is this, which is not great: ``` export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) ``` Instead of having users script this, I suggest adding an environment variable `$TRAVIS_CURRENT_BRANCH`.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue