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

Method createGiteaEntityHook

util/github/gitea.go:94–116  ·  view source on GitHub ↗
(ctx context.Context, hook *github.Hook)

Source from the content-addressed store, hash-verified

92}
93
94func (g *githubClient) createGiteaEntityHook(ctx context.Context, hook *github.Hook) (ret *github.Hook, err error) {
95 metrics.GithubOperationCount.WithLabelValues(
96 "CreateHook", // label: operation
97 g.entity.LabelScope(), // label: scope
98 ).Inc()
99 defer func() {
100 if err != nil {
101 metrics.GithubOperationFailedCount.WithLabelValues(
102 "CreateHook", // label: operation
103 g.entity.LabelScope(), // label: scope
104 ).Inc()
105 }
106 }()
107 switch g.entity.EntityType {
108 case params.ForgeEntityTypeRepository:
109 ret, err = g.createGiteaRepoHook(ctx, g.entity.Owner, g.entity.Name, hook)
110 case params.ForgeEntityTypeOrganization:
111 ret, err = g.createGiteaOrgHook(ctx, g.entity.Owner, hook)
112 default:
113 return nil, errors.New("invalid entity type")
114 }
115 return ret, err
116}

Callers 1

CreateEntityHookMethod · 0.95

Calls 3

createGiteaRepoHookMethod · 0.95
createGiteaOrgHookMethod · 0.95
LabelScopeMethod · 0.80

Tested by

no test coverage detected