Skip to content

Instantly share code, notes, and snippets.

@tmcw
Last active May 7, 2017 22:02
Show Gist options
  • Save tmcw/ff27b5ecfc748d06bc3317dc5570d474 to your computer and use it in GitHub Desktop.
Save tmcw/ff27b5ecfc748d06bc3317dc5570d474 to your computer and use it in GitHub Desktop.
(ns gh-finder.core
(:require [tentacles.repos :as repos])
(:gen-class))
(defn auth
"get an authentication token from the environment"
[]
{:auth (System/getenv "GITHUB_TOKEN")})
(defn get-branches
"get branches given a repository map"
[repo]
(when
(some (partial = "gh-pages")
(map :name (repos/branches
(:login (:owner repo))
(:name repo)
(auth))))
(:name repo)))
(defn -main
"print a list of repositories you own that have gh-pages branches"
[& args]
(->>
(merge (auth) {:all-pages true})
(repos/user-repos "tmcw")
(pmap get-branches)
(remove nil?)
(map (partial format "- %s"))
(clojure.string/join "\n")
(print)))
(defproject gh-finder "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[irresponsible/tentacles "0.6.1"]
[org.clojure/clojure "1.8.0"]]
:plugins [[lein-cljfmt "0.5.6"]]
:main ^:skip-aot gh-finder.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment