From 451639f6375adf6814062fa64f82304981206a66 Mon Sep 17 00:00:00 2001 From: myfreeer Date: Sun, 3 Mar 2024 20:12:22 +0800 Subject: [PATCH] ci-release: try to use curl to download artifacts https://github.com/website-local/mdn-local/actions/runs/8129229384/job/22216054601 Resolving productionresultssa14.blob.core.windows.net (productionresultssa14.blob.core.windows.net)... 20.209.74.225, 20.209.52.65, 20.209.75.97 Connecting to productionresultssa14.blob.core.windows.net (productionresultssa14.blob.core.windows.net)|20.209.74.225|:443... connected. HTTP request sent, awaiting response... 400 Authentication information is not given in the correct format. Check the value of Authorization header. 2024-03-03 09:27:31 ERROR 400: Authentication information is not given in the correct format. Check the value of Authorization header.. --- .github/workflows/ci-release.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 282b22c4..3306a460 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -48,7 +48,21 @@ jobs: mkdir -p download pushd download for url in $archive_download_urls; do - wget --header="Authorization: Bearer ${{ secrets.GH_ACTION_TOKEN }}" "$url" + auth_header="Authorization: Bearer ${{ secrets.GH_ACTION_TOKEN }}" + # Make the initial request with the Authorization header and capture the headers + response_headers=$(curl -s -I -L --header "$auth_header" "$url") + # Look for a Location header in case of a redirect + redirect_url=$(echo "$response_headers" | grep -i Location: | tail -n1 | sed -e 's/Location: //I' | tr -d '\r') + # Check if a redirect URL was found + if [ -n "$redirect_url" ]; then + echo "Redirect URL found: $redirect_url" + # Make a new request to the redirect URL without the Authorization header + curl -L "$redirect_url" -O + else + echo "No redirect URL found, downloading directly." + # If no redirect was found, download the file directly with the Authorization header + curl -L --header "$auth_header" "$url" -O + fi done mkdir -p ../release for zip_file in $(ls); do