From d0d0da180d05c3dd19d1d8dbb7d75a5f0fd0a3c7 Mon Sep 17 00:00:00 2001 From: Thibaud CANALE Date: Sat, 21 Dec 2024 01:38:49 +0100 Subject: [PATCH] ci: use jq to get gh cli (#2168) Signed-off-by: Thibaud CANALE --- install_gh.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install_gh.sh b/install_gh.sh index 2c8f46d47cf..08cbc6d5d42 100755 --- a/install_gh.sh +++ b/install_gh.sh @@ -4,9 +4,10 @@ set -ex GH_ARCH="amd64" -VERSION=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2- ) +TAG=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" | jq --raw-output '.tag_name' ) +VERSION=${TAG#v} -curl --retry 12 --retry-delay 120 -sSL "https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz" +curl --retry 12 --retry-delay 120 -sSL "https://github.com/cli/cli/releases/download/${TAG}/gh_${VERSION}_linux_${GH_ARCH}.tar.gz" -o "gh_${VERSION}_linux_${GH_ARCH}.tar.gz" tar xf "gh_${VERSION}_linux_${GH_ARCH}.tar.gz"