add Branch method for payload
This commit is contained in:
parent
7a76b0e1cb
commit
fe73e95554
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