Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e4aa8cba6c | |||
| 28d44801e9 | |||
| 7e745505c0 | |||
| d9e847f7ea |
+2
-1
@@ -21,6 +21,7 @@ before_install:
|
|||||||
- mkdir -p $GOPATH/src/gopkg.in
|
- mkdir -p $GOPATH/src/gopkg.in
|
||||||
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v2
|
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v2
|
||||||
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v3
|
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v3
|
||||||
|
- ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/webhooks.v4
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- go vet ./...
|
- go vet ./...
|
||||||
@@ -35,4 +36,4 @@ script:
|
|||||||
after_success: |
|
after_success: |
|
||||||
[ $TRAVIS_GO_VERSION = 1.10.2 ] &&
|
[ $TRAVIS_GO_VERSION = 1.10.2 ] &&
|
||||||
overalls -project="github.com/go-playground/webhooks" -covermode=count -ignore=.git,examples -debug &&
|
overalls -project="github.com/go-playground/webhooks" -covermode=count -ignore=.git,examples -debug &&
|
||||||
goveralls -coverprofile=overalls.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN
|
goveralls -coverprofile=overalls.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
Library webhooks
|
Library webhooks
|
||||||
================
|
================
|
||||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v3/logo.png">
|
<img align="right" src="https://raw.githubusercontent.com/go-playground/webhooks/v3/logo.png">
|
||||||
[](https://travis-ci.org/go-playground/webhooks)
|
[](https://travis-ci.org/go-playground/webhooks)
|
||||||
[](https://coveralls.io/github/go-playground/webhooks?branch=v3)
|
[](https://coveralls.io/github/go-playground/webhooks?branch=v3)
|
||||||
[](https://goreportcard.com/report/go-playground/webhooks)
|
[](https://goreportcard.com/report/go-playground/webhooks)
|
||||||
[](https://godoc.org/gopkg.in/go-playground/webhooks.v3)
|
[](https://godoc.org/gopkg.in/go-playground/webhooks.v4)
|
||||||

|

|
||||||
|
|
||||||
Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events
|
Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events
|
||||||
@@ -24,17 +24,17 @@ Installation
|
|||||||
Use go get.
|
Use go get.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
go get -u gopkg.in/go-playground/webhooks.v3
|
go get -u gopkg.in/go-playground/webhooks.v4
|
||||||
```
|
```
|
||||||
|
|
||||||
Then import the package into your own code.
|
Then import the package into your own code.
|
||||||
|
|
||||||
import "gopkg.in/go-playground/webhooks.v3"
|
import "gopkg.in/go-playground/webhooks.v4"
|
||||||
|
|
||||||
Usage and Documentation
|
Usage and Documentation
|
||||||
------
|
------
|
||||||
|
|
||||||
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v3 for detailed usage docs.
|
Please see http://godoc.org/gopkg.in/go-playground/webhooks.v4 for detailed usage docs.
|
||||||
|
|
||||||
##### Examples:
|
##### Examples:
|
||||||
|
|
||||||
@@ -46,8 +46,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
"gopkg.in/go-playground/webhooks.v3/github"
|
"gopkg.in/go-playground/webhooks.v4/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -103,8 +103,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
"gopkg.in/go-playground/webhooks.v3/github"
|
"gopkg.in/go-playground/webhooks.v4/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "gopkg.in/go-playground/assert.v1"
|
. "gopkg.in/go-playground/assert.v1"
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
"gopkg.in/go-playground/webhooks.v3/github"
|
"gopkg.in/go-playground/webhooks.v4/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -18,15 +18,15 @@ type myLogger struct {
|
|||||||
PrintDebugs bool
|
PrintDebugs bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *myLogger) Info(msg string) {
|
func (l *myLogger) Info(msg ...interface{}) {
|
||||||
log.Println(msg)
|
log.Println(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *myLogger) Error(msg string) {
|
func (l *myLogger) Error(msg ...interface{}) {
|
||||||
log.Println(msg)
|
log.Println(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *myLogger) Debug(msg string) {
|
func (l *myLogger) Debug(msg ...interface{}) {
|
||||||
if !l.PrintDebugs {
|
if !l.PrintDebugs {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
"gopkg.in/go-playground/webhooks.v3/github"
|
"gopkg.in/go-playground/webhooks.v4/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
"gopkg.in/go-playground/webhooks.v3/github"
|
"gopkg.in/go-playground/webhooks.v4/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "gopkg.in/go-playground/assert.v1"
|
. "gopkg.in/go-playground/assert.v1"
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "gopkg.in/go-playground/assert.v1"
|
. "gopkg.in/go-playground/assert.v1"
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTES:
|
// NOTES:
|
||||||
@@ -945,7 +945,7 @@ func TestMergeRequestEvent(t *testing.T) {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", "http://127.0.0.1:3011/webhooks", bytes.NewBuffer([]byte(payload)))
|
req, err := http.NewRequest("POST", "http://127.0.0.1:3011/webhooks", bytes.NewBuffer([]byte(payload)))
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
client "github.com/gogits/go-gogs-client"
|
client "github.com/gogits/go-gogs-client"
|
||||||
"gopkg.in/go-playground/webhooks.v3"
|
"gopkg.in/go-playground/webhooks.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhook instance contains all methods needed to process events
|
// Webhook instance contains all methods needed to process events
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ var DefaultLog Logger = new(logger)
|
|||||||
// Logger allows for customizable logging
|
// Logger allows for customizable logging
|
||||||
type Logger interface {
|
type Logger interface {
|
||||||
// Info prints basic information.
|
// Info prints basic information.
|
||||||
Info(string)
|
Info(...interface{})
|
||||||
// Error prints error information.
|
// Error prints error information.
|
||||||
Error(string)
|
Error(...interface{})
|
||||||
// Debug prints information usefull for debugging.
|
// Debug prints information usefull for debugging.
|
||||||
Debug(string)
|
Debug(...interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLogger returns a new logger for use.
|
// NewLogger returns a new logger for use.
|
||||||
@@ -26,17 +26,17 @@ type logger struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Info prints basic information.
|
// Info prints basic information.
|
||||||
func (l *logger) Info(msg string) {
|
func (l *logger) Info(msg ...interface{}) {
|
||||||
log.Println("INFO:", msg)
|
log.Println("INFO:", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// v prints error information.
|
// v prints error information.
|
||||||
func (l *logger) Error(msg string) {
|
func (l *logger) Error(msg ...interface{}) {
|
||||||
log.Println("ERROR:", msg)
|
log.Println("ERROR:", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug prints information usefull for debugging.
|
// Debug prints information usefull for debugging.
|
||||||
func (l *logger) Debug(msg string) {
|
func (l *logger) Debug(msg ...interface{}) {
|
||||||
if !l.PrintDebugs {
|
if !l.PrintDebugs {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user