branch: main
commit 2f26d0ce23400ec8d3c7f2a6611089d29a7a344b
Author: Romain GARBAGE <romain.garb...@inria.fr>
AuthorDate: Mon May 5 11:14:28 2025 +0200

    http: Handle extra action events in '/admin/forgejo/event'.
    
    * src/cuirass/http.scm (url-handler): Handle extra action events in 
'/admin/forgejo/event'.
    
    Signed-off-by: Ludovic Courtès <l...@gnu.org>
---
 src/cuirass/http.scm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index f976816..605753b 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -802,8 +802,9 @@ return DEFAULT."
               (let* ((event (json->forgejo-pull-request-event params))
                      (pull-request (forgejo-pull-request-event-pull-request 
event))
                      (spec (forgejo-pull-request->specification pull-request))
-                     (spec-name (specification-name spec)))
-                (match (forgejo-pull-request-event-action event)
+                     (spec-name (specification-name spec))
+                     (action (forgejo-pull-request-event-action event)))
+                (match action
                   ;; New pull request.
                   ((or 'opened 'reopened)
                    (if (not (db-get-specification spec-name))
@@ -846,7 +847,16 @@ return DEFAULT."
                            (begin
                              (log-warning "evaluation hook disabled")
                              (respond-json-with-error 400 "Evaluation hook 
disabled.")))
-                       (respond-json-with-error 404 "Jobset not found."))))))
+                       (respond-json-with-error 404 "Jobset not found.")))
+                  ;; Other action where nothing is done.
+                  (_
+                   (log-info "received action '~a' jobset '~a': nothing to do"
+                             action spec-name)
+                   (respond
+                    (build-response #:code 200
+                                    #:headers
+                                    `((location . ,(string->uri-reference 
"/"))))
+                    #:body "")))))
              (_ (respond-json-with-error 400 (format #f "Event type \"~a\" not 
supported." event-type))))
            (respond-json-with-error 400 "This API only supports JSON."))))
 

Reply via email to