Skip to content

Commit a6fcb9f

Browse files
Merge pull request #44 from gpaul/gpaul/fix-github-hooks-insecure
scm/driver/github: allow SkipVerify
2 parents 731e51d + 49562aa commit a6fcb9f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ require (
44
github.com/google/go-cmp v0.2.0
55
github.com/h2non/gock v1.0.9
66
)
7+
8+
go 1.13

scm/driver/github/repo.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type hook struct {
4646
URL string `json:"url"`
4747
Secret string `json:"secret"`
4848
ContentType string `json:"content_type"`
49+
InsecureSSL string `json:"insecure_ssl,omitempty"`
4950
} `json:"config"`
5051
}
5152

@@ -112,6 +113,9 @@ func (s *RepositoryService) CreateHook(ctx context.Context, repo string, input *
112113
in.Config.Secret = input.Secret
113114
in.Config.ContentType = "json"
114115
in.Config.URL = input.Target
116+
if input.SkipVerify {
117+
in.Config.InsecureSSL = "1"
118+
}
115119
in.Events = append(
116120
input.NativeEvents,
117121
convertHookEvents(input.Events)...,
@@ -198,10 +202,11 @@ func convertHookList(from []*hook) []*scm.Hook {
198202

199203
func convertHook(from *hook) *scm.Hook {
200204
return &scm.Hook{
201-
ID: strconv.Itoa(from.ID),
202-
Active: from.Active,
203-
Target: from.Config.URL,
204-
Events: from.Events,
205+
ID: strconv.Itoa(from.ID),
206+
Active: from.Active,
207+
Target: from.Config.URL,
208+
Events: from.Events,
209+
SkipVerify: from.Config.InsecureSSL == "1",
205210
}
206211
}
207212

0 commit comments

Comments
 (0)