Skip to content

Commit 5462959

Browse files
author
Dean Karn
authored
Merge pull request #18 from tulir/patch-2
[GitLab] Add support for confidential issues
2 parents 4964805 + 13e6611 commit 5462959

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

gitlab/gitlab.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ type Event string
2626

2727
// GitLab hook types
2828
const (
29-
PushEvents Event = "Push Hook"
30-
TagEvents Event = "Tag Push Hook"
31-
IssuesEvents Event = "Issue Hook"
32-
CommentEvents Event = "Note Hook"
33-
MergeRequestEvents Event = "Merge Request Hook"
34-
WikiPageEvents Event = "Wiki Page Hook"
35-
PipelineEvents Event = "Pipeline Hook"
36-
BuildEvents Event = "Build Hook"
29+
PushEvents Event = "Push Hook"
30+
TagEvents Event = "Tag Push Hook"
31+
IssuesEvents Event = "Issue Hook"
32+
ConfidentialIssuesEvents Event = "Confidential Issue Hook"
33+
CommentEvents Event = "Note Hook"
34+
MergeRequestEvents Event = "Merge Request Hook"
35+
WikiPageEvents Event = "Wiki Page Hook"
36+
PipelineEvents Event = "Pipeline Hook"
37+
BuildEvents Event = "Build Hook"
3738
)
3839

3940
// New creates and returns a WebHook instance denoted by the Provider type
@@ -112,6 +113,11 @@ func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request) {
112113
json.Unmarshal([]byte(payload), &te)
113114
hook.runProcessPayloadFunc(fn, te, hd)
114115

116+
case ConfidentialIssuesEvents:
117+
var cie ConfidentialIssueEventPayload
118+
json.Unmarshal([]byte(payload), &cie)
119+
hook.runProcessPayloadFunc(fn, cie, hd)
120+
115121
case IssuesEvents:
116122
var ie IssueEventPayload
117123
json.Unmarshal([]byte(payload), &ie)

gitlab/payload.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ type IssueEventPayload struct {
4040
Assignee Assignee `json:"assignee"`
4141
}
4242

43+
// ConfidentialIssueEventPayload contains the information for GitLab's confidential issue event
44+
type ConfidentialIssueEventPayload struct {
45+
// The data for confidential issues is currently the same as normal issues,
46+
// so we can just embed the normal issue payload type here.
47+
IssueEventPayload
48+
}
49+
4350
// MergeRequestEventPayload contains the information for GitLab's merge request event
4451
type MergeRequestEventPayload struct {
4552
ObjectKind string `json:"object_kind"`

0 commit comments

Comments
 (0)