Skip to content

Commit b72eefb

Browse files
Add secret flag
1 parent b3accae commit b72eefb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

webhook/create_webhook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type hookConfig struct {
2222
ContentType string `json:"content_type"`
2323
InsecureSSL string `json:"insecure_ssl"`
2424
URL string `json:"url"`
25+
Secret string `json:"secret,omitempty"`
2526
}
2627

2728
type createHookResponse struct {
@@ -54,6 +55,7 @@ func createHook(o *hookOptions) (string, func() error, error) {
5455
Config: hookConfig{
5556
ContentType: "json",
5657
InsecureSSL: "0",
58+
Secret: o.Secret,
5759
},
5860
}
5961

webhook/forward.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type hookOptions struct {
2626
Repo string
2727
Org string
2828
Port int
29+
Secret string
2930
}
3031

3132
// NewCmdForward returns a forward command.
@@ -89,6 +90,7 @@ func NewCmdForward(runF func(*hookOptions) error) *cobra.Command {
8990
cmd.Flags().IntVarP(&opts.Port, "port", "P", 0, "(optional) Local port where the server which will receive webhooks is running")
9091
cmd.Flags().StringVarP(&opts.Host, "host", "H", "", "(optional) Host address of GitHub API, default: api.github.com")
9192
cmd.Flags().StringVarP(&opts.Org, "org", "O", "", "Name of the org where the webhook is installed")
93+
cmd.Flags().StringVarP(&opts.Secret, "secret", "S", "", "(optional) webhook secret for incoing events")
9294
return cmd
9395
}
9496

0 commit comments

Comments
 (0)