Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 2d7ad67

Browse files
committed
Merge pull request #1 from compressed/branch_helper
add Branch method for payload
2 parents 7a76b0e + fe73e95 commit 2d7ad67

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

repo_hooks.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"errors"
1111
"fmt"
1212
"net/http"
13+
"strings"
1314
)
1415

1516
var (
@@ -115,3 +116,8 @@ func ParseHook(raw []byte) (*Payload, error) {
115116
}
116117
return hook, nil
117118
}
119+
120+
// Branch returns branch name from a payload
121+
func (h *Payload) Branch() string {
122+
return strings.Replace(h.Ref, "refs/heads/", "", -1)
123+
}

0 commit comments

Comments
 (0)