Repository navigation
Closed
Labels
Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).enhancementgood first issue
Description
The CreateHook method
go-github/github/repos_hooks.go
Line 85 in 6ca4d14
| func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { |
currently wants a Hook parameter that has Config of type map[string]interface{}
go-github/github/repos_hooks.go
Line 54 in 6ca4d14
| Config map[string]interface{} `json:"config,omitempty"` |
This forces the user to manually define each config properties.
My proposal is to change the Config to HookConfig, that for some reasons I'm not aware of is defined here:
go-github/github/orgs_audit_log.go
Lines 24 to 31 in 6ca4d14
| type HookConfig struct { | |
| ContentType *string `json:"content_type,omitempty"` | |
| InsecureSSL *string `json:"insecure_ssl,omitempty"` | |
| URL *string `json:"url,omitempty"` | |
| // Secret is returned obfuscated by GitHub, but it can be set for outgoing requests. | |
| Secret *string `json:"secret,omitempty"` | |
| } |
This could be a breaking change for people currently using the CreateHook function (and every other functions taking Hook as input) so I am asking first how you want to proceed about it.
Metadata
Metadata
Assignees
Labels
Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).enhancementgood first issue
Activity
gmlewis commentedon Feb 13, 2024
Hmmm... excellent point. From the official docs, I don't see any reason why we shouldn't switch
Configover to*HookConfigand have a breaking API change.You might also want to provide a godoc comment for the
InsecureSSLfield since the warnings in the official docs look pretty serious.Would you like to make a PR, @himazawa, or shall I open this issue up to other contributors?
himazawa commentedon Feb 13, 2024
On it.
I also noticed that:
https://github.com/google/go-github/blob/master/github/apps_hooks.go#L18
https://github.com/google/go-github/blob/master/github/orgs_hooks_configuration.go#L18
https://github.com/google/go-github/blob/master/github/repos_hooks_configuration.go#L18
and
https://github.com/google/go-github/blob/master/github/apps_hooks.go#L39
https://github.com/google/go-github/blob/master/github/orgs_hooks_configuration.go#L39
https://github.com/google/go-github/blob/master/github/repos_hooks_configuration.go#L39
are basically the same code. Do you want to create two generic function for them?
gmlewis commentedon Feb 14, 2024
I'm this repo, we have consciously tried to always support the most recent two minor versions of the Go compiler, and now with the release of Go 1.22.0 I think it is now safe to say that Go generics are a welcome addition!
Later tonight I will try to update the maintenance scripts and GitHub Action workflow scripts to support versions 1.21.x and 1.22.x of the Go compiler.
After that gets merged, we should be able to accept PRs with generics.
🎉
himazawa commentedon Feb 14, 2024
Wait, I was not talking about "generic" in that way. There is no need for them in this specific case, but we can use a a common function for all of them.
The real question is: is it ok if we aggregate this 3 functions into one?
gmlewis commentedon Feb 14, 2024
Looking now at your six links, no, we will not be aggregating all the functions into one, as that goes against the overall philosophy of this repo. This repo provides methods for each endpoint, and each of those links have different endpoints and/or HTTP methods, so they are all unique and will remain distinct. Thanks for asking.
Sorry for not looking at your links before responding earlier - that was my bad.
feat!: Change Hook.Config field from map to *HookConfig (#3073)
feat!: Change Hook.Config field from map to *HookConfig (google#3073)