Simplify format of issues in MR descriptions

This commit is contained in:
Ray Miller 2025-06-27 09:28:20 +00:00
parent 3816a547fe
commit 58b85e4f5e

View file

@ -201,15 +201,10 @@ values strings or #f, in which case the parameter is skipped."
(define (get-tag s) (define (get-tag s)
(let ((i (string-index s #\:))) (let ((i (string-index s #\:)))
(and i (substring s 0 i)))) (and i (substring s 0 i))))
(define (format-issue x)
(format #f "* ~a [~a](~a)~%"
(assoc-ref x 'type)
(assoc-ref x 'name)
(assoc-ref x 'url)))
(let ((tag (get-tag title)) (let ((tag (get-tag title))
(issues (if (null? related-issues) (issues (if (null? related-issues)
"n/a" "n/a"
(string-join (map format-issue related-issues) "\n"))) (string-join (map (cut format #f "* ~a~%" <>) related-issues) "\n")))
(s merge-request-template)) (s merge-request-template))
(define (tag-selected x) (if (string=? x tag) "X" " ")) (define (tag-selected x) (if (string=? x tag) "X" " "))
(-> s (-> s
@ -225,15 +220,15 @@ values strings or #f, in which case the parameter is skipped."
(string-replace-substring "@@chore@@" (tag-selected "Chore")) (string-replace-substring "@@chore@@" (tag-selected "Chore"))
(string-replace-substring "@@issues@@" issues)))) (string-replace-substring "@@issues@@" issues))))
(define*-public (create-merge-request client (define*-public (create-merge-request client #:key
#:key project-path project-path
source-branch source-branch
target-branch target-branch
title title
(description "") (description "")
(related-issues '()) (related-issues '())
assignee assignee
reviewers (reviewers '())
(remove-source-branch #t) (remove-source-branch #t)
(squash #t)) (squash #t))
(let* ((project-id (get-project-id client project-path)) (let* ((project-id (get-project-id client project-path))