Created
September 27, 2021 22:09
-
-
Save littleli/8029e57797a8ea16116b15175630078c to your computer and use it in GitHub Desktop.
List github releases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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