Skip to content

Instantly share code, notes, and snippets.

@littleli
Created September 27, 2021 22:09
Show Gist options
  • Save littleli/8029e57797a8ea16116b15175630078c to your computer and use it in GitHub Desktop.
Save littleli/8029e57797a8ea16116b15175630078c to your computer and use it in GitHub Desktop.
List github releases
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {borkdude/gh-artifacts
{:git/url "https://github.com/borkdude/gh-release-artifact"
:git/sha "2f8898d84126a4e922c490f8614211a8b0cf67cd"}}})
(assert (System/getenv "GITHUB_TOKEN") "GITHUB_TOKEN env var not set")
(require '[borkdude.gh-release-artifact :as gh])
(def args
(into {}
(for [[arg-name arg-val] (partition 2 (rest *command-line-args*))]
[(keyword (subs arg-name 1)) arg-val])))
(defn list-releases []
(assert (args :org) (args :repo))
(let [releases (gh/list-releases (args :org) (args :repo))]
(run! #(when-let [n (not-empty (:name %))] (println n)) releases)))
(case (first *command-line-args*)
"list" (list-releases)
(println "Usage: gh-releases <subcommand> :org <org> :repo <repo> Available subcommands: list"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment