Skip to content

Commit c7e0275

Browse files
committed
fix pr checker
1 parent f022f61 commit c7e0275

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

script/update_or_create_pr.clj

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,27 @@
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

0 commit comments

Comments
 (0)