fix: retry gh install on failure

This commit is contained in:
Baptiste Augrain
2025-07-24 08:57:00 +02:00
parent abf3fc3fc2
commit bfdcc2257b
3 changed files with 15 additions and 7 deletions

View File

@@ -118,7 +118,7 @@ fi
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i -eq 3 ]]; then
if [[ $i == 3 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi

View File

@@ -13,7 +13,7 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
for i in {1..5}; do # try 5 times
npm ci && break
if [[ $i -eq 3 ]]; then
if [[ $i == 3 ]]; then
echo "Npm install failed too many times" >&2
exit 1
fi

View File

@@ -4,12 +4,20 @@ set -ex
GH_ARCH="amd64"
TAG=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" 2>/dev/null | jq --raw-output '.tag_name' )
for i in {1..5}; do
TAG=$( curl --retry 12 --retry-delay 30 "https://api.github.com/repos/cli/cli/releases/latest" 2>/dev/null | jq --raw-output '.tag_name' )
if [[ $? -ne 0 ]] || [[ "${TAG}" == "null" ]]; then
echo "Error: Failed to retrieve the latest tag from GitHub CLI releases."
exit 1
fi
if [[ $? == 0 && "${TAG}" != "null" ]]; then
break
fi
if [[ $i == 3 ]]; then
echo "GH install failed too many times" >&2
exit 1
fi
echo "GH install failed $i, trying again..."
done
VERSION="${TAG#v}"