Actions

Git/GitHub

From Ever changing code

< Git

List releases

get_latest_release () { 
  # curl --silent "https://api.github.com/repos/$1/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' # no sed
    curl --silent "https://api.github.com/repos/$1/releases/latest" | # get latest release
      grep --color=auto '"tag_name":' |                               # get tag_name object
      sed -E 's/.*"([^"]+)".*/\1/'                                    # drop JSON
}


Get all releases

curl --silent "https://api.github.com/repos/kubernetes/minikube/releases/latest" | jq -r .tag_name
v1.7.3

curl --silent "https://api.github.com/repos/kubernetes/minikube/releases" | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' # add head 1 and you have latest release
v1.7.3
v1.7.2
v1.7.1
v1.7.0


Get the latest tag

curl -s GET https://api.github.com/repos/hashicorp/vagrant/tags | jq -r '.[].name' | head -n1
v2.2.18