fix: ifElseChain linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This commit is contained in:
parent
b0e3f78fbb
commit
9f405e0e8f
3 changed files with 23 additions and 22 deletions
|
|
@ -107,19 +107,21 @@ func (a *APIController) handleWorkflowJobEvent(ctx context.Context, w http.Respo
|
|||
hookType := r.Header.Get("X-Github-Hook-Installation-Target-Type")
|
||||
|
||||
if err := a.r.DispatchWorkflowJob(hookType, signature, body); err != nil {
|
||||
if errors.Is(err, gErrors.ErrNotFound) {
|
||||
switch {
|
||||
case errors.Is(err, gErrors.ErrNotFound):
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"owner_unknown", // label: reason
|
||||
).Inc()
|
||||
slog.With(slog.Any("error", err)).ErrorContext(ctx, "got not found error from DispatchWorkflowJob. webhook not meant for us?")
|
||||
return
|
||||
} else if strings.Contains(err.Error(), "signature") { // nolint:golangci-lint,godox TODO: check error type
|
||||
case strings.Contains(err.Error(), "signature"):
|
||||
// nolint:golangci-lint,godox TODO: check error type
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"signature_invalid", // label: reason
|
||||
).Inc()
|
||||
} else {
|
||||
default:
|
||||
metrics.WebhooksReceived.WithLabelValues(
|
||||
"false", // label: valid
|
||||
"unknown", // label: reason
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue