File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -7,23 +7,29 @@ be integrated with one.
7
7
Installation
8
8
-----------------------------------------------
9
9
10
- $ go get github.com/rjz/githubhook
10
+ ``` ShellSession
11
+ $ go get github.com/rjz/githubhook
12
+ ```
11
13
12
14
Usage
13
15
-----------------------------------------------
14
16
15
17
Given an incoming ` *http.Request ` representing a webhook signed with a ` secret ` ,
16
18
use ` githubhook ` to validate and parse its content:
17
19
18
- secret := []byte("don't tell!")
19
- hook, err := githubhook.Parse(secret, req)
20
+ ``` go
21
+ secret := []byte (" don't tell!" )
22
+ hook , err := githubhook.Parse (secret, req)
23
+ ```
20
24
21
25
Plays nicely with the [ google/go-github] [ gh-go-github ] client!
22
26
23
- evt := github.PullRequestEvent{}
24
- if err := json.Unmarshal(hook.Payload, &evt); err != nil {
25
- fmt.Println("Invalid JSON?", err)
26
- }
27
+ ``` go
28
+ evt := github.PullRequestEvent {}
29
+ if err := json.Unmarshal (hook.Payload , &evt); err != nil {
30
+ fmt.Println (" Invalid JSON?" , err)
31
+ }
32
+ ```
27
33
28
34
[ gh-webhook ] : https://developer.github.com/webhooks/
29
35
[ gh-go-github ] : https://github.com/google/go-github
You can’t perform that action at this time.
0 commit comments