Skip to content

Commit

Permalink
Add secret flag
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-at-work committed Oct 24, 2022
1 parent b3accae commit b72eefb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions webhook/create_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type hookConfig struct {
ContentType string `json:"content_type"`
InsecureSSL string `json:"insecure_ssl"`
URL string `json:"url"`
Secret string `json:"secret,omitempty"`
}

type createHookResponse struct {
Expand Down Expand Up @@ -54,6 +55,7 @@ func createHook(o *hookOptions) (string, func() error, error) {
Config: hookConfig{
ContentType: "json",
InsecureSSL: "0",
Secret: o.Secret,
},
}

Expand Down
2 changes: 2 additions & 0 deletions webhook/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type hookOptions struct {
Repo string
Org string
Port int
Secret string
}

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

Expand Down

0 comments on commit b72eefb

Please sign in to comment.