From e443251b23fc0c02d645da86df71b52c60ee37b9 Mon Sep 17 00:00:00 2001 From: Julien Vincent Date: Sun, 29 Oct 2023 16:45:05 +0000 Subject: [PATCH] Cache github auth token --- src/k16/kl/api/github.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/k16/kl/api/github.clj b/src/k16/kl/api/github.clj index 66d6d28..3187b76 100644 --- a/src/k16/kl/api/github.clj +++ b/src/k16/kl/api/github.clj @@ -6,9 +6,13 @@ (set! *warn-on-reflection* true) +(def ^:private cached-auth-token + (delay + (let [res (proc/sh ["gh" "auth" "token"])] + (-> res :out str/trim)))) + (defn- get-auth-token [] - (let [res (proc/sh ["gh" "auth" "token"])] - (-> res :out str/trim))) + @cached-auth-token) (defn request [{:keys [path headers]}] (let [res