[bug#76809,Cuirass,2/3] forgejo: Support for Agit workflow.

Message ID 20250307110025.12928-2-romain.garbage@inria.fr
State New
Headers
Series Agit workflow support |

Commit Message

Romain GARBAGE March 7, 2025, 11 a.m. UTC
  This commit adds support for the Agit workflow (see
https://forgejo.org/docs/latest/user/agit-support/).
In this case the provided "ref" is not an existing branch and the channel
can't be fetched.

* src/cuirass/forges/forgejo.scm (forgejo-pull-request->specification): Build
channel from commit instead of branch.
* tests/forgejo.scm: Update test.
---
 src/cuirass/forges/forgejo.scm | 3 ++-
 tests/forgejo.scm              | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/src/cuirass/forges/forgejo.scm b/src/cuirass/forges/forgejo.scm
index 73ab609..40d1279 100644
--- a/src/cuirass/forges/forgejo.scm
+++ b/src/cuirass/forges/forgejo.scm
@@ -94,6 +94,7 @@ 
                         (forgejo-repository-reference-repository
                          (forgejo-pull-request-base pull-request))))
          (source-branch (forgejo-repository-reference-ref source-repo-reference))
+         (source-commit (forgejo-repository-reference-sha source-repo-reference))
          (source-url (forgejo-repository-url
                       (forgejo-repository-reference-repository source-repo-reference)))
          (id (forgejo-pull-request-number pull-request))
@@ -129,7 +130,7 @@ 
       (cons* (channel
               (name project-name)
               (url source-url)
-              (branch source-branch))
+              (commit source-commit))
              %default-channels))
      (priority priority)
      (period period)
diff --git a/tests/forgejo.scm b/tests/forgejo.scm
index 2718bb3..ba3675a 100644
--- a/tests/forgejo.scm
+++ b/tests/forgejo.scm
@@ -76,7 +76,7 @@ 
      (cons* (channel
              (name 'project-name)
              (url "https://forgejo.instance.test/source-repo/fork-name.git")
-             (branch "test-branch"))
+             (commit "582af40e8a059fa05c7048a7ac4f2eccbbd0183b"))
             %default-channels))
     (priority %default-jobset-options-priority)
     (period %default-jobset-options-period)