github / gh-codeql

GitHub CLI extension for working with CodeQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`latest` version is by date rather than semantic version order

edoardopirovano opened this issue · comments

As @aibaars points out, our method of getting the latest version sorts the versions by date rather than semantic version number:

version=$(gh api "repos/$repo/releases/latest" --jq '.tag_name')

This will break if we release a patch to an old version as that will then be considered the newest version. Instead, he suggests we do something like:
gh api "repos/github/$repo/releases" --jq '.[].tag_name' | sort --version-sort | tail -1