From 886b98bdcee09bd3cc0cd45b56e7f4825e0edbb1 Mon Sep 17 00:00:00 2001 From: Asim Arshad Date: Fri, 15 May 2026 10:39:00 +0100 Subject: [PATCH] fix: retry latest version resolution --- action.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 181c5d9..2bb423f 100644 --- a/action.yml +++ b/action.yml @@ -32,11 +32,30 @@ runs: INPUT_VERSION: ${{ inputs.version }} run: | if [ "$INPUT_VERSION" = "latest" ]; then - VERSION="$(curl -fsSL "https://install.tessl.io/scripts/latest.sh" | grep 'TESSL_VERSION="' | head -1 | sed 's/.*TESSL_VERSION="\([^"]*\)".*/\1/')" + VERSION="" + RESPONSE_FILE="$(mktemp)" + for attempt in 1 2 3; do + if curl -fsSL "https://install.tessl.io/scripts/latest.sh" -o "$RESPONSE_FILE"; then + VERSION="$(grep 'TESSL_VERSION="' "$RESPONSE_FILE" | head -1 | sed 's/.*TESSL_VERSION="\([^"]*\)".*/\1/')" + fi + if [ -n "$VERSION" ]; then + break + fi + if [ "$attempt" -lt 3 ]; then + sleep $((2 ** attempt)) + fi + done if [ -z "$VERSION" ]; then - echo "::error::Failed to resolve latest tessl version" + echo "::error::Failed to resolve latest tessl version after 3 attempts" + if [ -s "$RESPONSE_FILE" ]; then + echo "::group::latest.sh response preview" + head -20 "$RESPONSE_FILE" + echo "::endgroup::" + fi + rm -f "$RESPONSE_FILE" exit 1 fi + rm -f "$RESPONSE_FILE" echo "Resolved latest version: ${VERSION}" else VERSION="$INPUT_VERSION"