8000 Abort early when no labels set · coder/labeler@a181f62 · GitHub
[go: up one dir, main page]

Skip to content

Commit a181f62

Browse files
committed
Abort early when no labels set
1 parent 047ce81 commit a181f62

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

service.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ func (s *Service) webhook(w http.ResponseWriter, r *http.Request) *httpjson.Resp
316316
return s.serverError(err)
317317
}
318318

319+
if len(resp.SetLabels) == 0 {
320+
return &httpjson.Response{
321+
Status: http.StatusOK,
322+
Body: httpjson.M{"message": "no labels to set"},
323+
}
324+
}
325+
319326
// Set the labels.
320327
instConfig, err := s.AppConfig.InstallationConfig(strconv.FormatInt(payload.Installation.ID, 10))
321328
if err != nil {
@@ -331,7 +338,7 @@ func (s *Service) webhook(w http.ResponseWriter, r *http.Request) *httpjson.Resp
331338
resp.SetLabels,
332339
)
333340
if err != nil {
334-
return s.serverError(err)
341+
return s.serverError(fmt.Errorf("set %v: %w", resp.SetLabels, err))
335342
}
336343

337344
log := s.Log.With(

0 commit comments

Comments
 (0)
0