File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 22(ns update-or-create-pr
33 (:require [babashka.process :as p :refer [sh shell]]
44 [babashka.fs :as fs]
5- [cheshire.core :as json]))
5+ [cheshire.core :as json]
6+ [clojure.string :as str]))
67
78(defn usage []
89 (println " Usage: script/update_or_create_pr.clj branchname" )
910 (System/exit 1 ))
1011
1112(def artifact-dirs [" _docs" " _site/docs" ]) ; ; Directories to copy
1213
14+
15+
1316(defn existing-pr? [target-branch]
14- (let [pr-json
15- (slurp
16- (-> (str " https://api.github.com/repos/metabase/docs.metabase.github.io/pulls?head=metabase:" target-branch)
17- (shell {:out :string :continue true })))
18- _ (println " → PR JSON:" pr-json)
19- o (some #(when (= target-branch (% " title" )) (% " number" ))
20- (json/parse-string pr-json))]
17+ (let [pr-data (->
18+ (shell {:out :string :continue true }
19+ " curl"
20+ (str " https://api.github.com/repos/metabase/docs.metabase.github.io/pulls?head=metabase:" " update-" " doc-update-detection" ))
21+ :out
22+ json/parse-string)
23+ o (some #(when (= target-branch (get % " title" ))
24+ (get % " number" ))
25+ pr-data)]
2126 (println " → PR number:" o)
2227 (boolean o)))
2328
You can’t perform that action at this time.
0 commit comments