branch: main
commit 33e2a2e7aed204429d4c5dbb5de0c8586d816ebb
Author: Romain GARBAGE <romain.garb...@inria.fr>
AuthorDate: Wed May 7 11:18:26 2025 +0200

    forgejo: Add support for pull request draft status.
    
    * src/cuirass/forges/forgejo.scm (<forgejo-pull-request>): Add DRAFT? field.
    (forgejo-pull-request->specification): Set IS-ACTIVE? according to draft 
status.
    * tests/http.scm: Update tests.
    * tests/forgejo.scm: Update tests.
    
    Signed-off-by: Ludovic Courtès <l...@gnu.org>
---
 src/cuirass/forges/forgejo.scm | 2 ++
 tests/forgejo.scm              | 3 +++
 tests/http.scm                 | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/src/cuirass/forges/forgejo.scm b/src/cuirass/forges/forgejo.scm
index 3bef964..2e451ed 100644
--- a/src/cuirass/forges/forgejo.scm
+++ b/src/cuirass/forges/forgejo.scm
@@ -111,6 +111,7 @@
            json->forgejo-repository-reference)
   (head    forgejo-pull-request-head "head"
            json->forgejo-repository-reference)
+  (draft?  forgejo-pull-request-draft? "draft")
   (body    forgejo-pull-request-body))
 
 ;; This mapping is used to define various JSON objects such as "base" or
@@ -172,6 +173,7 @@
      (priority priority)
      (period period)
      (systems systems)
+     (is-active? (not (forgejo-pull-request-draft? pull-request)))
      (properties
       (let ((repository (forgejo-repository-reference-repository
                          (forgejo-pull-request-base pull-request))))
diff --git a/tests/forgejo.scm b/tests/forgejo.scm
index 6b3e0dd..d7e8c71 100644
--- a/tests/forgejo.scm
+++ b/tests/forgejo.scm
@@ -42,6 +42,7 @@
     \"pull_request\": {
       \"number\": 1,
       \"state\": \"open\",
+      \"draft\": false,
       \"url\": \"https://forgejo.instance.test/base-repo/pulls/1\";,
       \"body\": \"Some content.\",
       \"base\": {
@@ -106,6 +107,7 @@
     \"state\": \"open\",
     \"url\": \"https://forgejo.instance.test/base-repo/pulls/1\";,
     \"body\": \"Some content.\",
+    \"draft\": false,
     \"base\": {
       \"label\": \"base-label\",
       \"ref\": \"base-branch\",
@@ -171,6 +173,7 @@
     \"number\": 1,
     \"state\": \"open\",
     \"url\": \"https://forgejo.instance.test/base-repo/pulls/1\";,
+    \"draft\": false,
     \"body\": \"Some content.\\nNew content.\",
     \"base\": {
       \"label\": \"base-label\",
diff --git a/tests/http.scm b/tests/http.scm
index cff2892..cbe0e9c 100644
--- a/tests/http.scm
+++ b/tests/http.scm
@@ -155,6 +155,7 @@
     \"pull_request\": {
       \"number\": 1,
       \"state\": \"open\",
+      \"draft\": false,
       \"url\": \"https://forgejo.instance.test/base-repo/pulls/1\";,
       \"base\": {
         \"label\": \"base-label\",
@@ -192,6 +193,7 @@
     \"pull_request\": {
       \"number\": 1,
       \"state\": \"closed\",
+      \"draft\": false,
       \"base\": {
         \"label\": \"base-label\",
         \"ref\": \"base-branch\",

Reply via email to