Merge pull request #1 from compressed/branch_helper
add Branch method for payload
This commit is contained in:
commit
2d7ad67259
1 changed files with 6 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -115,3 +116,8 @@ func ParseHook(raw []byte) (*Payload, error) {
|
||||||
}
|
}
|
||||||
return hook, nil
|
return hook, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Branch returns branch name from a payload
|
||||||
|
func (h *Payload) Branch() string {
|
||||||
|
return strings.Replace(h.Ref, "refs/heads/", "", -1)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue