mattn/goveralls — pull request #30 by joshuarubin (2014-05-08 18:30:26+00:00)
Title: Set git branch name from environment if available

When using wercker, the git tree is checked out by sha so running `git rev-parse --abbrev-ref HEAD` simply returns `HEAD`. This is not so helpful in coveralls.

This patch enables the possibility of using the `GIT_BRANCH` environment variable to get the branch name.

When using wercker, the branch is set to the `WERCKER_GIT_BRANCH` environment variable so something like this is still necessary in the `wercker.yml`:

```yaml
build:
steps:
...

# Test the project
- script:
name: go test
code: |
export GIT_BRANCH=$WERCKER_GIT_BRANCH
goveralls -v -service wercker -repotoken $COVERALLS_REPO_TOKEN
```