From 29aa616976105179fe48cf3cd5fc9c5dff394ba2 Mon Sep 17 00:00:00 2001 From: Jason Birch Date: Tue, 9 Jul 2024 20:55:44 +1000 Subject: [PATCH] Follow GitHub redirects when finding the latest version Follow GitHub's recommendation to follow redirects when using their API (https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#follow-redirects%22). GitHub has started to return 301 responses when we ask for the latest version. However, this location is the one location we fail to follow redirects. Fixes #35. --- hack/autoinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/autoinstall.sh b/hack/autoinstall.sh index 3c5e906..f385407 100644 --- a/hack/autoinstall.sh +++ b/hack/autoinstall.sh @@ -22,7 +22,7 @@ detect_package_suffix() { # Function to get the latest release tag from GitHub get_latest_release() { local repo="$1" - curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' + curl -s -L "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' } github_repo="uptime-lab/computeblade-agent"