Implement webhooks install for gitea
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
08511e2e7f
commit
5dfcfc542e
3 changed files with 113 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ func (g *githubClient) GetEntityHook(ctx context.Context, id int64) (ret *github
|
|||
return ret, err
|
||||
}
|
||||
|
||||
func (g *githubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) (ret *github.Hook, err error) {
|
||||
func (g *githubClient) createGithubEntityHook(ctx context.Context, hook *github.Hook) (ret *github.Hook, err error) {
|
||||
metrics.GithubOperationCount.WithLabelValues(
|
||||
"CreateHook", // label: operation
|
||||
g.entity.LabelScope(), // label: scope
|
||||
|
|
@ -116,6 +116,17 @@ func (g *githubClient) CreateEntityHook(ctx context.Context, hook *github.Hook)
|
|||
return ret, err
|
||||
}
|
||||
|
||||
func (g *githubClient) CreateEntityHook(ctx context.Context, hook *github.Hook) (ret *github.Hook, err error) {
|
||||
switch g.entity.Credentials.ForgeType {
|
||||
case params.GithubEndpointType:
|
||||
return g.createGithubEntityHook(ctx, hook)
|
||||
case params.GiteaEndpointType:
|
||||
return g.createGiteaEntityHook(ctx, hook)
|
||||
default:
|
||||
return nil, errors.New("invalid entity type")
|
||||
}
|
||||
}
|
||||
|
||||
func (g *githubClient) DeleteEntityHook(ctx context.Context, id int64) (ret *github.Response, err error) {
|
||||
metrics.GithubOperationCount.WithLabelValues(
|
||||
"DeleteHook", // label: operation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue