Skip to content

Commit

Permalink
apply the title in pull-request title when there is just one migration (
Browse files Browse the repository at this point in the history
  • Loading branch information
dimmyjr-nu authored Oct 1, 2024
1 parent 0d1b52b commit 9180026
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/ordnungsamt/render.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(ns ordnungsamt.render
(:require [clojure.string]
[ordnungsamt.utils :as utils]
[selmer.parser :as selmer]
[selmer.parser]
[selmer.util :refer [without-escaping]]))

(defn render-title [context]
(selmer.parser/render "[Auto] Refactors - {{date}}" context))
(if (-> context :migrations count (= 1))
(selmer.parser/render "[Auto] {{title}}" (-> context :migrations first))
(selmer.parser/render "[Auto] Refactors - {{date}}" context)))

(def migration-template
"## {{title}} [{{created-at}}]
Expand Down
2 changes: 1 addition & 1 deletion test/integration/integration/apply_migrations_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(and (= (:path request)
(str "/repos/" org "/" repository "/pulls"))
(standalone/match?
{:title #(clojure.string/starts-with? % title-prefix)
{:title #(or (clojure.string/starts-with? % title-prefix) (clojure.string/includes? % (-> migrations first :title)))
:body (fn [txt] (every? (partial includes-migration-info? txt)
migrations))}
(json/parse-string (:body request) keyword)))))
Expand Down

0 comments on commit 9180026

Please sign in to comment.