From 0f7bd89263cd8104a6b1aef3fa9fdd1590f61e9e Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 11:50:42 +0100 Subject: [PATCH] Add retry logic and authentication to ACS deployment version fetch (#5051) * Initial plan * Add retry logic and authentication to ACS deployment version fetch Co-authored-by: pmacius <158472457+pmacius@users.noreply.github.com> * Update .github/actions/deploy-local-acs/action.yml --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pmacius <158472457+pmacius@users.noreply.github.com> --- .github/actions/deploy-local-acs/action.yml | 36 +++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-local-acs/action.yml b/.github/actions/deploy-local-acs/action.yml index dfbbdb36f..e355ef71b 100644 --- a/.github/actions/deploy-local-acs/action.yml +++ b/.github/actions/deploy-local-acs/action.yml @@ -69,11 +69,41 @@ runs: shell: bash env: ACS_VERSION_INPUT: ${{ inputs.acs_deployment_version }} + GITHUB_TOKEN: ${{ github.token }} run: | if [ "$ACS_VERSION_INPUT" = "latest" ]; then - latest_tag=$(curl -s https://api.github.com/repos/Alfresco/acs-deployment/releases/latest | jq -r .tag_name) - echo "Using latest ACS deployment version: $latest_tag" - echo "version=$latest_tag" >> $GITHUB_OUTPUT + max_retries=3 + retry_count=0 + latest_tag="" + + while [ $retry_count -lt $max_retries ]; do + echo "Attempt $((retry_count + 1)) of $max_retries to fetch latest ACS deployment version..." + if [ -n "$GITHUB_TOKEN" ]; then + response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/Alfresco/acs-deployment/releases/latest) + else + response=$(curl -s https://api.github.com/repos/Alfresco/acs-deployment/releases/latest) + fi + + latest_tag=$(echo "$response" | jq -r .tag_name 2>/dev/null || echo "") + if [ "$latest_tag" != "null" ] && [ -n "$latest_tag" ]; then + echo "Successfully fetched latest ACS deployment version: $latest_tag" + echo "version=$latest_tag" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Warning: Received invalid response (tag_name: $latest_tag)" + retry_count=$((retry_count + 1)) + + if [ $retry_count -lt $max_retries ]; then + sleep_time=$((2 ** retry_count)) + echo "Retrying in $sleep_time seconds..." + sleep $sleep_time + fi + done + + echo "Error: Failed to fetch latest ACS deployment version after $max_retries attempts" + echo "Last response: $response" + exit 1 else echo "Using specified ACS deployment version: $ACS_VERSION_INPUT" echo "version=$ACS_VERSION_INPUT" >> $GITHUB_OUTPUT