Christian Egli | 71ecde4 | 2022-12-15 14:34:29 +0100 | [diff] [blame] | 1 | (ns tasks |
| 2 | (:require |
| 3 | [babashka.process :refer [process shell]] |
| 4 | [clojure.string :as str])) |
| 5 | |
| 6 | ;; majorly inspired by the Announce script from git, see |
| 7 | ;; https://github.com/git/git/blob/ecaae0c78185918cb24292407354f58c043b6ca8/Announce |
| 8 | |
| 9 | (defn latest-release [] |
| 10 | (->> "git describe --abbrev=0" |
| 11 | (shell {:out :string}) |
| 12 | :out |
| 13 | str/trim)) |
| 14 | |
| 15 | (defn authors |
| 16 | ([] (authors (latest-release))) |
| 17 | ([release] |
| 18 | (->> release |
| 19 | (format "git shortlog -s --no-merges --group=author --group=trailer:co-authored-by %s..") |
| 20 | (shell {:out :string}) |
| 21 | :out |
| 22 | str/split-lines |
| 23 | (map (fn [line] (-> line (str/split #"\t") second))) |
| 24 | (sort-by str/lower-case) |
| 25 | (str/join ", ")))) |
| 26 | |
| 27 | (defn changes-since |
| 28 | ([] (changes-since (latest-release))) |
| 29 | ([release] |
| 30 | (-> (process (format "git log --no-merges %s.." release)) |
| 31 | (process {:out :string} "git shortlog") |
| 32 | deref |
| 33 | :out))) |
| 34 | |