MCPcopy Create free account
hub / github.com/cloudbase/garm / getGhRepoWebhook

Function getGhRepoWebhook

test/integration/repositories_test.go:117–132  ·  view source on GitHub ↗
(url, ghToken, orgName, repoName string)

Source from the content-addressed store, hash-verified

115}
116
117func getGhRepoWebhook(url, ghToken, orgName, repoName string) (*github.Hook, error) {
118 client := getGithubClient(ghToken)
119 ghRepoHooks, _, err := client.Repositories.ListHooks(context.Background(), orgName, repoName, nil)
120 if err != nil {
121 return nil, err
122 }
123
124 for _, hook := range ghRepoHooks {
125 hookURL := hook.Config.GetURL()
126 if hookURL == url {
127 return hook, nil
128 }
129 }
130
131 return nil, nil
132}
133
134func getGithubClient(oauthToken string) *github.Client {
135 ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: oauthToken})

Calls 2

getGithubClientFunction · 0.70
GetURLMethod · 0.45

Tested by

no test coverage detected